aarch64: Fix early RA handling of deleted insns [PR113094]
commit803d222e533efbc385411d4b5a2d0ec0551b9f16
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 21 Dec 2023 10:20:19 +0000 (21 10:20 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 21 Dec 2023 10:20:19 +0000 (21 10:20 +0000)
tree2f5e37991cb5eb3d4455a2c6e6410c90848144fb
parent81dfa84e35659bc8adff945e61b02bc76c4c7f1e
aarch64: Fix early RA handling of deleted insns [PR113094]

The testcase constructs a sequence of insns that are fully dead
and yet (due to forced options) are not removed as such.  This
triggered a case where we would emit a meaningless reload for a
to-be-deleted insn.

We can't delete the insns first because that might disrupt the
iteration ranges.  So this patch turns them into notes before
the walk and then continues to delete them properly afterwards.

gcc/
PR target/113094
* config/aarch64/aarch64-early-ra.cc (apply_allocation): Stub
out instructions that are going to be deleted before iterating
over the rest.

gcc/testsuite/
PR target/113094
* gcc.target/aarch64/pr113094.c: New test.
gcc/config/aarch64/aarch64-early-ra.cc
gcc/testsuite/gcc.target/aarch64/pr113094.c [new file with mode: 0644]