https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127936
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:97b691c72ba88be598dfb49d5cb6546df966519c commit r17-5274-g97b691c72ba88be598dfb49d5cb6546df966519c Author: Yongqiang Tian <[email protected]> Date: Sat Oct 17 08:39:52 2026 -0600 [PATCH] rtl, aarch64, riscv: Ignore leading debug insns [PR127934, PR127936] Both rest_of_insert_bti and riscv_mode_needed need the first executable instruction in the function, but get_first_nonnote_insn can return a leading DEBUG_INSN. This makes their decisions depend on debug information. On AArch64 this can add a redundant BTI C before PACIASP. On RISC-V it can prevent a singleton VXRM setting from being hoisted to the function entry. Add get_first_nonnote_nondebug_insn and use it at both sites. Add regression tests that check both -fcompare-debug and the expected generated code. Tested at b3a3ecc46023 on x86_64-pc-linux-gnu with a native bootstrap and the gcc and g++ testsuites, comparing unmodified and patched trees. The summary counts and sorted FAIL lines are unchanged. The focused AArch64 and RISC-V tests also pass with the patch and fail without it. LLM-Review-Assistance: GCC Sashiko v0.6.0 PR target/127934 PR target/127936 gcc/ChangeLog: * config/arm/aarch-bti-insert.cc (rest_of_insert_bti): Use get_first_nonnote_nondebug_insn. * config/riscv/riscv.cc (riscv_mode_needed): Likewise. * emit-rtl.cc (get_first_nonnote_nondebug_insn): New function. * rtl.h (get_first_nonnote_nondebug_insn): Declare. gcc/testsuite/ChangeLog: * gcc.target/aarch64/bti-debug-1.c: New test. * gcc.target/riscv/rvv/base/vxrm-debug-1.c: New test. Suggested-by: Andrew Pinski <[email protected]> Signed-off-by: Yongqiang Tian <[email protected]>
