[LLVMdev] How to update LiveInterval information of newly inserted machine basic block
Andrew Trick
atrick at apple.com
Mon Jan 6 09:04:22 PST 2014
On Jan 5, 2014, at 5:24 AM, Haishan <hndxvon at 163.com> wrote:
>
> At 2014-01-05 03:28:22,"Andrew Trick" <atrick at apple.com> wrote:
>
> 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
>
> Hi,
> Thank you very much for replying.
> I have some doubt about only using computeVirtRegs function to update LiveInterval.
> There are two other functions like "computeRegMasks() computeLiveInRegUnits()" in runOnMachineFunction of LiveIntervalAnalysis.cpp.
> So, I think that these two functions maybe effect updating LiveInterval information.
> What do you think of two functions?
Yes, the safest thing would be to effectively rerun the LiveIntervals pass. After finishing your CFG changes, You could try:
releaseMemory()
VirtRegIntervals.resize(MRI->getNumVirtRegs());
computeVirtRegs();
computeRegMasks();
computeLiveInRegUnits();
I haven't tried this myself, so you may need to experiment/debug.
-Andy
>
> Thank you very much again.
> -Haishan
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140106/170d750e/attachment.html>
More information about the llvm-dev
mailing list