<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jan 3, 2014, at 4:58 AM, Haishan <<a href="mailto:hndxvon@163.com">hndxvon@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial;"><div><br>At 2014-01-01 04:36:21,"Andrew Trick" <<a href="mailto:atrick@apple.com">atrick@apple.com</a>> wrote:<br><blockquote id="isReplyContent" style="padding-left: 1ex; margin: 0px 0px 0px 0.8ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid; "><br><div><div>On Dec 31, 2013, at 3:52 AM, Haishan <<a href="mailto:hndxvon@163.com">hndxvon@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; ">Hi,<div>  I insert a new machine basic block(MBB) before Greedy Register Allocation, after Simple Register Coalescing. But I encounter a fatal </div><div>error "regalloc = ... not currently supported with -O0". I use command line with opt level O2, not O0.</div><div>The probable reason of this error is that no LiveInterval information for newly MBB which is used by Register Allocation.</div><div>And, LiveIntervals depend on LiveVariables which require the machine function to be in SSA form.</div><div>However, in this case, the modified machine function(including newly inserted MBB) is not SSA form any more.</div><div>So, how to update LiveInterval information of newly MBB?</div><div>Could someone help me with that?</div><div>Thank you very much in advance.</div><div>-Haishan</div></div></blockquote><div><br></div>Yes, I think error that means LiveIntervals have been invalidated. It is supposed to be user-friendly but should probably be changed to be more specific.</div><div><br></div><div>If you schedule a new pass between coalescing and regalloc, it needs to preserve LiveIntervals analysis. There are utilities to recompute live intervals for individual virtual registers. See LiveIntervals::computeVirtRegs. LiveVariables is not actually needed to update live intervals. It is only added as a requirement to make sure it runs before the 2-address pass.</div><div><br></div><div>-Andy</div><div><br></div></blockquote></div><div></div><span style="line-height: 200%; "><div>  Thank you for your reply.</div><div>  I do it as you tell me, and you are right.</div><div>  My update steps are shown following:</div><div>  LiveIntervals *LIS = &getAnalysis<LiveIntervals>();</div><div>    1. LIS->insertMBBInMaps(NewMBB)</div><div>    2. LIS->InsertMachineInstrRangeInMaps(NewMBB->begin(), NewMBB->end())</div><div>    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.</div><div>    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.</div><div>  However, I get an unreachable error "Use not jointly dominated by defs" in LiveRangeCalc.cpp:188.</div><div>So, comparing with Step3, Step4 generates an unreachable error, Why?</div><div>  Valid information of OldMBB is deleted when updating CFG? Is there something wrong with my updating steps?</div><div>  Thank you very much again.</div></span></div></blockquote><br></div><div>I’m haven’t done anything like this so I can only guess.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Hope it works.</div><div><br></div><div>-Andy</div></body></html>