[LLVMdev] How to update LiveInterval information of newly inserted machine basic block

Andrew Trick
Sat, 04 Jan 2014 19:28:22 -0000

On Jan 4, 2014, at 4:38 AM, Haishan <hndxvon at 163.com> wrote:

>  At 2014-01-04 06:11:38,"Jakob Stoklund Olesen" <stoklund at
2pi.dk> wrote:
>
> On Jan 3, 2014, at 1:52 PM, Andrew Trick <atrick at apple.com> wrote:
>
>> He really just wants to rerun LiveIntervals analysis, but LiveVariables
is no longer available. Would it work just to clear all the intervals rerun
LiveIntervals::computeVirtRegs after all the CFG transforms are complete?
>
> Yes, I should think so.
>
> /jakob
>
>
> Thank you very much for your talk.
> I think I could append more information about updating LiveIntervals.
> 1. It works well if I just use from step1 to step3, without step4.
> 2. In step4, I firstly use UnreachableBlockElim pass to delete OldMBB.
> Then, remove all intervals and recompute all the virtual registers'
LiveIntervals.
> 3. I debug source code in LiveRangeCalc.cpp and copy partial code shown
following.
> /// LiveRangeCalc.cpp
> ...
> #ifndef NDEBUG
>     if (MBB->pred_empty()) {
>       MBB->getParent()->verify();
>       llvm_unreachable("Use not jointly dominated by defs.");
>     }
> ...
> /// LiveRangeCalc.cpp
> This MBB is the first block of MachineFunction. That's to say, This MBB
doesn't have predecessor. It is reasonable?
> From debug information, this unreachable error is generated from recompute
a virtual register which isn't used or defined in this MBB. But this virtual
register, in NewMBB,  is defined in a machine instruction which is copied from
OldMBB.
> So I am puzzled.
> Then, I do as Andy's suggestion, but it doesn't work, and it has
same error.
> Could you have any suggestion?
> Thank you very much again.

Incrementally updating the live intervals will be complicated. You may be able
to completely recompute them by clearing all VirtRegIntervals, then calling
computeVirtRegs.

-Andy

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