diff options
author | Alex Coplan <alex.coplan@arm.com> | 2025-03-05 15:45:09 +0000 |
---|---|---|
committer | Alex Coplan <alex.coplan@arm.com> | 2025-03-06 11:37:00 +0000 |
commit | d6d7da92fb598c50d25332011bffe6b6515c9669 (patch) | |
tree | 8c78f08940570b44c286155b95ec60a19271d7c1 /gcc | |
parent | de231924b73bc120bf2b7ada4eeccd884c249ee1 (diff) | |
download | gcc-d6d7da92fb598c50d25332011bffe6b6515c9669.zip gcc-d6d7da92fb598c50d25332011bffe6b6515c9669.tar.gz gcc-d6d7da92fb598c50d25332011bffe6b6515c9669.tar.bz2 |
pair-fusion: Add singleton move_range asserts [PR114492]
The PR claims that pair-fusion has invalid uses of gcc_assert (such that
the pass will misbehave with --disable-checking). As noted in the
comments, in the case of the calls to restrict_movement, the only way we
can possibly depend on the side effects is if we call it with a
non-singleton move range. However, the intent is that we always have a
singleton move range here, and thus we do not rely on the side effects.
This patch therefore adds asserts to check for a singleton move range
before calling restrict_movement, thus clarifying the intent and
hopefully dispelling any concerns that having the calls wrapped in
asserts is problematic here.
gcc/ChangeLog:
PR rtl-optimization/114492
* pair-fusion.cc (pair_fusion_bb_info::fuse_pair): Check for singleton
move range before calling restrict_movement.
(pair_fusion::try_promote_writeback): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/pair-fusion.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/pair-fusion.cc b/gcc/pair-fusion.cc index 72e6424..a4ef728 100644 --- a/gcc/pair-fusion.cc +++ b/gcc/pair-fusion.cc @@ -1994,7 +1994,8 @@ pair_fusion_bb_info::fuse_pair (bool load_p, auto ignore = ignore_changing_insns (changes); for (unsigned i = 0; i < changes.length (); i++) - gcc_assert (rtl_ssa::restrict_movement (*changes[i], ignore)); + gcc_assert (changes[i]->move_range.singleton () + && rtl_ssa::restrict_movement (*changes[i], ignore)); // Check the pair pattern is recog'd. if (!rtl_ssa::recog (attempt, *pair_change, ignore)) @@ -3084,7 +3085,8 @@ pair_fusion::try_promote_writeback (insn_info *insn, bool load_p) auto ignore = ignore_changing_insns (changes); for (unsigned i = 0; i < ARRAY_SIZE (changes); i++) - gcc_assert (rtl_ssa::restrict_movement (*changes[i], ignore)); + gcc_assert (changes[i]->move_range.singleton () + && rtl_ssa::restrict_movement (*changes[i], ignore)); if (!rtl_ssa::recog (attempt, pair_change, ignore)) { |