https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127726
--- Comment #5 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:125d0919fa1c22925cb346ebf48f51ec3f7ca8d2 commit r17-5196-g125d0919fa1c22925cb346ebf48f51ec3f7ca8d2 Author: Yongqiang Tian <[email protected]> Date: Wed Oct 14 07:20:45 2026 -0600 resource: Ignore debug insns in find_basic_block [PR127726] find_basic_block walks backward toward a BARRIER with a bounded search. prev_nonnote_insn returns DEBUG_INSNs, so debug markers consume the max-delay-slot-live-search budget. Exhausting the budget makes mark_target_live_regs treat every register as live and can prevent an ordinary instruction from filling a delay slot. The forward label scan has the same debug dependence. This issue was already tracked as PR127726. Jeff Law also suggested auditing find_basic_block while reviewing the PR127808 patch. This patch uses the nondebug neighbour helpers in both walks and adds a focused SPARC test whose live-search budget is just large enough without its debug marker. Tested at GCC revision ca33fb40100211b9ed8c2e686b46cb9025791930: * The new test fails without the patch with an -fcompare-debug length mismatch and passes with the patch on sparc-elf and mips-elf. * A complete sparc-elf sparc.exp comparison has no regressions; the only difference is the new test changing from absent to PASS. * Native x86_64-pc-linux-gnu bootstrap and full regression testing completed for the baseline and the exact patch. Both produced 530002 PASS, 9 FAIL, 1 XPASS, 4292 XFAIL, and 7556 UNSUPPORTED results, with identical unexpected-result sets. * contrib/check_GNU_style.sh and git diff --check pass. Assisted-by: OpenAI Codex 5.6 Sol, co-reviewed by Claude and Yongqiang Tian. PR rtl-optimization/127726 gcc/ChangeLog: * resource.cc (find_basic_block): Ignore debug instructions in the backward and forward scans. gcc/testsuite/ChangeLog: * gcc.target/sparc/resource-live-search-debug.c: New test.
