https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113094
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:803d222e533efbc385411d4b5a2d0ec0551b9f16 commit r14-6781-g803d222e533efbc385411d4b5a2d0ec0551b9f16 Author: Richard Sandiford <richard.sandif...@arm.com> Date: Thu Dec 21 10:20:19 2023 +0000 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.