[llvm-dev] Update liveIntervals after inserting a MachineBasicBlock

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 18 11:55:46 PDT 2015


What are the predecessors and successors of your new basic block C? Depending on how you change the control flow it may be necessary to create new SSA value numbers in the live intervals.

- Matthias

> On Aug 18, 2015, at 11:08 AM, Ziqiang Patrick Huang via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi all, 
> 
> Suppose I have two basic blocks A->B and I want to insert a new basic block C between A and B, so that A->C->B. Right now I'm able to insert the block and correctly update the SlotIndexes. But I'm having trouble updating the LiveIntervals, so at very least I have to make sure all registers that are live in into B are live through C.
> 
> Suppose after inserting C the Slot Index range for the 3 blocks are 
> 
> A [0, 20]
> C [28, 40]
> B [44, 60]
> 
> and the liveInterval of %verg 1 is (4r, 52r). So right now the liveInterval already covers C, but later I'm failing an assertion in LiveIntervals::shrinkToUses() function.
> 
> // Make sure VNI is live-out from the predecessors.                                                                                                    
>       for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(),
>            PE = MBB->pred_end(); PI != PE; ++PI) {
>         if (!LiveOut.insert(*PI))
>           continue;
>         SlotIndex Stop = getMBBEndIdx(*PI);
>         assert(li->getVNInfoBefore(Stop) == VNI &&
>                "Wrong value out of predecessor");
>         WorkList.push_back(std::make_pair(Stop, VNI));
>       }
> 
> so I print out li here and it's (4r, 28B) [44B, 52r), so at some point the live interval of %vreg 1 is split and LLVM has no idea that register live through C, which means I must have missed updating something when I create C. 
> 
> I'm doing this in MachineScheduler Pass,
> 
> Dear Cameron, I CC you because when I google to find some clue, I noticed you submit a patch for MachineBasicBlock::SplitCriticalEdge() on updating liveIntervals, so I thought maybe you might be able to help me. I tried the same method you did but still did not pass that assertion.
> 
> Thanks in advance,
> Patrick  
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=owCLIXjMdMpT1E9Ei7smWg&m=1O2X9YrN73trxqdIaBKAcydvoDmyUk7JO8tqXirxPFs&s=Ko0u_rqSFSQPF0hUNUh7yXjchSNMMXNx3yHTgnvMriA&e= 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150818/2054dd9d/attachment.html>


More information about the llvm-dev mailing list