This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [LRA] Fix wrong-code PR 91109 take 2

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

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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]