On 9/2/26 10:28 PM, 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]>
I don't recognize your email/name, so I'm going to assume no commit privileges at this time.  So I went ahead and pushed this to the trunk given Vladimir's ack.

These bugs are often hard to find, so thanks as ton for chasing it down!

jeff

Reply via email to