On 1/28/25 1:11 PM, Surya Kumari Jangala wrote:
Hi,
The following patch has been bootstrapped and regtested on powerpc64le-linux,
aarch64-linux and x86_64-linux. This patch is a proposed fix for PR118533.
Request you to please review the patch.
Regards
Surya
lra: initialize allocated_hard_reg_p[] for hard regs referenced in RTL
[PR118533]
When computing the costs of the hard registers in assign_hard_reg(), the
cost of saving/restoring a callee-save register in the prolog/epilog is
taken into consideration. However, if some other pseudo has already been
assigned that hard register, then any further assignments of that hard
register don't need to be charged the save/restore cost, since it has
already been accounted for. The array allocated_hardreg_p[] specifies if
a hard register has already been allocated to an allocno. This array is
updated whenever a register is assigned. This array should also be
updated if any hard register is referenced in the RTL because any such
register usage should count as the "first" usage. A hard register
reference can occur in the RTL due to inline asm specifying a register
for a local variable, or a target’s machine pattern can explicitly
reference a hard register.
Sorry for delay with the answer. But this problem was already solved in
January for PR118497 by the following patch:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=c4dae80357ccf2e035d8e9ec0a3bb319344c5b41;hp=10850f92b2a618ef1b1ad399530943ef4847823d
Also I am agree with Mike Matz we don't need additional insn scan (which
is very costly for RTL). The above patch avoids full RTL scanning.
2025-01-28 Surya Kumari Jangala <jskum...@linux.ibm.com>
gcc/
PR rtl-optimization/118533
* ira-color.cc (initialize_allocated_hardreg): New function.
(color): Initialize array.
---