[Bug target/96017] Powerpc suboptimal register spill in likely path

bergner at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 2 01:18:45 GMT 2020


--- Comment #6 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #5)
> But it is r31 already before
> shrink-wrapping -- we need some renaming / copying of registers (like
> in Peter's code) to get rid of it.  In an example like this it is
> quite useful, but in a lot of "real world" code there are no free
> volatile registers to scarf up.  Or that was my impression anyway,
> when I last looked at this.  Time to revisit it...

Right, that's why we need to add the copies before RA, so we don't have to look
for unused regs.  But we don't want to add the copies too early just for the
optimizer to remove them on us.  Like it did for my manually added copies.

There is ira.c:split_live_ranges_for_shrink_wrap().  I'll have a look to see
why it's not catching this test case. 

> (The "ELFv1" code is just
> which feels simpler...  but it is kind of the same?

It does look better, but marginally so, since we still stack a frame and
save/restore r31 on the fast path.

More information about the Gcc-bugs mailing list