On 2019-08-16 11:06 a.m., Vladimir Makarov wrote:

On 2019-08-15 3:46 p.m., Bernd Edlinger wrote:
Hi,

as discussed in the PR 91109 audit trail,
my previous patch missed a case where no spilling is necessary,
but the re-materialized instruction has now scratch regs without
a hard register assignment.  And thus the LRA pass falls out of
the loop pre-maturely.

Fixed by checking for scratch regs with no assignment
and continuing the loop in that case.


Boot-strapped and reg-tested on x86_64-pc-linux-gnu and arm-linux-gnueabihf.
Is it OK for trunk?

Sorry, I am afraid this patch can make LRA cycle forever in some cases.

The reason for this is an existing pattern (scratch "r,X").  So if LRA makes a choice for the 2nd alternative, it will be a former spilled scratch (such spilled pseudo is changed into scratch at the end of LRA).  In this case the constraint subpass satisfies all constraints. There are no changes at all but because there are spilled (not in remat subpass) former scratches we continue the loop.

I guess you need something more accurate interaction with remat subpass.


Sorry, I missed that your new code is run only if remat returns true which means some changes in it.  It was not seen in the patch context.  So there will be no cycling as remat at some point stop to do changes.

The patch is ok for trunk and gcc-9 branch.

Thank you, Bernd


Reply via email to