On 9/3/26 12:28 AM, Yongqiang Tian wrote:
The simple-LRA decision uses get_max_uid() as an approximation of the
number of instructions.  Debug instructions consume UIDs, so enabling
debug information can cross the threshold and change register allocation
and generated code.

Use get_max_insn_count(), which excludes debug instructions, so the
decision depends only on ordinary instructions.  Add an -fcompare-debug
regression test.

Bootstrapped and regression tested on x86_64-pc-linux-gnu.

        PR debug/108784

gcc/ChangeLog:

        * ira.cc (ira): Use get_max_insn_count instead of get_max_uid when
        selecting simple LRA.

gcc/testsuite/ChangeLog:

        * gcc.dg/pr108784.c: New test.

Assisted-by: OpenAI Codex 5.6 Sol
Assisted-by: Claude
Signed-off-by: Yongqiang Tian<[email protected]>
---
  gcc/ira.cc                      |  8 +++--
  gcc/testsuite/gcc.dg/pr108784.c | 63 +++++++++++++++++++++++++++++++++
  2 files changed, 68 insertions(+), 3 deletions(-)
  create mode 100644 gcc/testsuite/gcc.dg/pr108784.c


The patch complies with GCC AI policy.  OK for me to commit it to trunk.  Thank you for fixing this.

Reply via email to