Update the LiveVariables analysis after the special handling for
unspillable terminators which was added in D91358. This is just enough
to fix some "Block should not be in AliveBlocks" / "Block missing from
AliveBlocks" errors in the codegen test suite when machine verification
is forced to run after PHIElimination (currently it is disabled).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This sounds conceptually OK to me - that we would need to update the live variables for unspillable terminators - but I don't know a lot about updating LV, so don't know a lot of the details.
Should the Incoming blocks be the Src blocks, or should it be a combination of Incoming and Src?
I think at this point IncomingReg is a freshly created register, so it won't have any AliveBlocks yet.
Having said that I admit I don't understand all the details either, I was just doing the minimum to get verification to pass, since my next project is to remove LiveVariables anyway in favour of LiveIntervals.
LGTM.
Please try if the suggested changes work. If not then I'm fine with the change as-is.
llvm/lib/CodeGen/PHIElimination.cpp | ||
---|---|---|
465–471 | As far as I can tell, the other code here that creates COPYs etc. does not bother creating a information for IncomingReg. So maybe we should do the same here and just concern ourself with dropping the old info? |
If it helps, I would expect the unspillable terminators to look like:
bb1: .. %r = UnspillableTerminator .. bb2: %p = phi %r, ... ... uses of %p
In our usecase in the Arm backend, bb2 will be a loop header, usually with a single block (but not necessarily, especially in the future).
In the tests I am looking at, there is a preheader block in between your bb1 and bb2, and %r is live-through the preheader.
llvm/lib/CodeGen/PHIElimination.cpp | ||
---|---|---|
465–471 |
There is certainly some existing code that updates LV info for IncomingReg, though I haven't looked at it in detail.
That only fixes the "Block should not be in AliveBlocks" errors, not the "Block missing from AliveBlocks" errors. |
As far as I can tell, the other code here that creates COPYs etc. does not bother creating a information for IncomingReg. So maybe we should do the same here and just concern ourself with dropping the old info?