<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 25, 2013 at 7:24 PM, Manman Ren <span dir="ltr"><<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">
<div class="im">On Wed, Oct 23, 2013 at 10:13 AM, Francois Pichet <span dir="ltr"><<a href="mailto:pichet2000@gmail.com" target="_blank">pichet2000@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi, this change break the Opus DSP out of tree backend. (we just updated to trunk)<div>

<br></div><div>The reason is that the Opus DSP backend end up creating a new  BasicBlock in eliminateCallFramePseudoInstr (called by <span style="font-family:arial,sans-serif;font-size:13px">replaceFrameIndices)</span></div>


<div>Your change assume that the no new BBs are created in <span style="font-family:arial,sans-serif;font-size:13px">replaceFrameIndices</span></div><div><div><br></div><div>Because:</div><div>  SmallVector<int, 8> SPState;</div>


<div>  SPState.resize(Fn.getNumBlockIDs());</div></div><div><br></div><div>SPState won't change size.</div><div><br></div><div>Is it reasonable to change your loop to be able to deal with new BasicBlock created during replaceFrameIndices. It might not be I haven't really analyzed everything but it is working if I revert this specific commit.</div>

</div></blockquote><div><br></div></div><div>Before the commit, we use</div><div><div class="im">   for (MachineFunction::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) {<br></div><div class="im">     int SPAdj = 0;<br>
     replaceFrameIndices(BB, Fn, SPAdj);<br>
   }<br></div></div><div><br></div><div>I don't think it will work if <span style="font-family:arial,sans-serif;font-size:13px">replaceFrameIndices can create new BBs.</span></div><div>Let's figure out the issue first, then talk about what to do.</div>

<div><br></div><div><br></div></div></div></div></blockquote><div><br></div><div>It was working because the iterator will use ++BB to get the the next BasicBlock and the new BB were always added after the current BB.</div>
<div><br></div><div>Now I realize that creating a new BB in eliminateCallFramePseudoInstr was not ideal.</div><div><br></div><div>What we are trying to do is creating a new BB after each function call; that new BB is used to get the return address that we assign to a register before calling the function. the called function will then jump using that register to return.</div>
<div><br></div><div>I guess i'll move that logic elsewhere.</div><div><br></div><div><br></div></div></div></div>