https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118533
Peter Bergner <bergner at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org, | |segher at gcc dot gnu.org, | |vmakarov at gcc dot gnu.org --- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> --- (In reply to Surya Kumari Jangala from comment #0) > 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 a hard reg is being used (due > to inline asm specifying a register for a local variable). So the process is, when we first attempt to assign a non-volatile/callee-saved register to a pseudo, then we must increase its allocation cost to account for the extra prologue/epilogue insns that are required to save/restore that hard register. If however, some other pseudo has already assigned that hard register, then any further assignments of that hard register don't need to be charged that save/restore cost, since we've already accounted for it. I agree that any hard register usage in an inline asm should count as that "first" usage, so updating allocated_hardreg_p[] does seem appropriate. That said, there can be other hard register usage other than in inline asms. A target's machine pattern my just decide (for better or worse) to explicitly reference a hard register in its patterns. Therefore, we should look for any hard register usage in normal rtl insns and add those to allocated_hardreg_p[] too.