[LLVMdev] How to update LiveInterval information of newly inserted machine basic block
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri Jan 3 13:49:38 PST 2014
On Jan 3, 2014, at 1:06 PM, Andrew Trick <atrick at apple.com> wrote:
> On Jan 3, 2014, at 12:10 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>> On Jan 3, 2014, at 11:01 AM, Andrew Trick <atrick at apple.com> wrote:
>>> On Jan 3, 2014, at 4:58 AM, Haishan <hndxvon at 163.com> wrote:
>>>> At 2014-01-01 04:36:21,"Andrew Trick" <atrick at apple.com> wrote:
>>>> On Dec 31, 2013, at 3:52 AM, Haishan <hndxvon at 163.com> wrote:
>>>> My update steps are shown following:
>>>> LiveIntervals *LIS = &getAnalysis<LiveIntervals>();
>>>> 1. LIS->insertMBBInMaps(NewMBB)
>>>> 2. LIS->InsertMachineInstrRangeInMaps(NewMBB->begin(), NewMBB->end())
>>>> 3. Due to some machine instructions of NewMBB copy from OldMBB, I have to removeInterval firstly. Then I use LIS->createAndComputeVirtRegInterval() to update LiveInterval info of NewMBB.
>>>> 4. Then I want to delete OldMBB in the current MachineFuncion. At the same time, delete LiveIntervals info of OldMBB. So, firstly, Use RemoveMachineInstrFromMaps() to erase SlotIndexes info of OldMBB. And, delete OldMBB from current CFG. Lastly, remove all registers' interval, create and recompute virtual register interval info.
>>>> However, I get an unreachable error "Use not jointly dominated by defs" in LiveRangeCalc.cpp:188.
>>>> So, comparing with Step3, Step4 generates an unreachable error, Why?
>>>> Valid information of OldMBB is deleted when updating CFG? Is there something wrong with my updating steps?
>>>> Thank you very much again.
>>> I’m haven’t done anything like this so I can only guess.
>>> The error means that some path from function entry does not provide a reaching def for a vreg. You’ll have to analyze the CFG and debug to understand why.
>>> My suggestion would be to completely update the CFG first, with no connections to the old block. Remove the old block, it’s instructions and vregs from maps. Then add the new block to maps and recompute.
>>> You might need to keep track of any vregs referenced in the old block but not in the new block to ensure they are updated.
>> Those LIS->insert…() functions are only proxies for the corresponding functions on SlotIndexes. They only add the necessary slot indexes, they don’t update any liveness information.
>> We don’t have any support for updating liveness after inserting a new basic block. There is no reason you couldn’t do it, but the code doesn’t exist.
> Haishan is using createAndComputeVirtRegInterval for each vreg. I guess this should work if removeInterval is called first.
The problem is with all the other virtual registers in the function. You need to decide if they are live through the new block or not. That isn’t computed automatically.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev