diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2024-08-15 16:54:02 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2024-08-15 16:54:02 +0100 |
commit | 70ae0daeb76f28a3135f4a74d6e440fb1d9821fa (patch) | |
tree | 144403e8da4f7b75f8d8c09f27117a65db9b8a10 /gcc/dwarf2codeview.cc | |
parent | dbf4c574b92bc692a0380a2b5ee25028321e735f (diff) | |
download | gcc-70ae0daeb76f28a3135f4a74d6e440fb1d9821fa.zip gcc-70ae0daeb76f28a3135f4a74d6e440fb1d9821fa.tar.gz gcc-70ae0daeb76f28a3135f4a74d6e440fb1d9821fa.tar.bz2 |
late-combine: Preserve INSN_CODE when modifying notes [PR116343]
When it removes a definition, late-combine tries to update all
uses in notes. It does this using the same insn_propagation class
that it uses for patterns.
However, insn_propagation uses validate_change, which in turn
resets the INSN_CODE. This is inefficient in the best case,
since it forces the pattern to be rerecognised even though
changing a note can't affect the INSN_CODE. But in the PR
it's a correctness problem: resetting INSN_CODE means we lose
the NOOP_INSN_MOVE_CODE, which in turn means that rtl-ssa doesn't
queue it for deletion.
This patch adds a routine specifically for propagating into notes.
A belt-and-braces fix would be to rerecognise noop moves in
function_info::change_insns, but I can't think of a good reason
why that would be necessary, and it could paper over latent bugs.
gcc/
PR testsuite/116343
* recog.h (insn_propagation::apply_to_note): Declare.
* recog.cc (insn_propagation::apply_to_note): New function.
* late-combine.cc (insn_combination::substitute_note): Use
apply_to_note instead of apply_to_rvalue.
* rtl-ssa/changes.cc (rtl_ssa::changes_are_worthwhile): Improve
dumping of costs for noop moves.
gcc/testsuite/
PR testsuite/116343
* gcc.dg/torture/pr116343.c: New test.
Diffstat (limited to 'gcc/dwarf2codeview.cc')
0 files changed, 0 insertions, 0 deletions