<div dir="ltr">Thank You !!<div>Help me a lot !!</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> 於 2020年3月13日 週五 下午2:36寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Did you transfer the successors of BB1 to BB2 and add BB2 as a successor of BB1? This note in code you referenced refers to that "<font color="#000000">NOTE: Successor list of the original BB is out of date after this function, and must be updated by the caller!" </font></div><div><font color="#000000"><br></font></div><div><font color="#000000">See this code in </font>ARMConstantIslands::splitBlockBeforeInstr</div><div><br></div><div>  // Update the CFG.  All succs of OrigBB are now succs of NewBB.<br>  NewBB->transferSuccessors(OrigBB);<br><br>  // OrigBB branches to NewBB.<br>  OrigBB->addSuccessor(NewBB);<br></div><div><span style="color:rgb(178,34,34);font-style:italic"><br></span></div><div><br></div><div><br clear="all"><div><div dir="ltr">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 12, 2020 at 10:20 PM PenYiWang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi<div><br></div><div>I am developing some machine function pass.</div><div><br></div><div>I want to split MachineBasicBlcok when I find some specific machine instruction.</div><div><br></div><div>But I don't insert or delete any machine instruction.</div><div><br></div><div>I just "simply" , "purely" split the MachineBasicBlcok. </div><div><br></div><div>(So, I stole the idea from ARM64BranchRelaxation::splitBlockBeforeInstr.)</div><div><br></div><div>This is my code :</div><div><br></div><div>// I would pass call instruction to this function</div><div><br></div><div>void split_mbb(MachineInstr* mi){<br></div><div>  MachineBasicBlock* mbb=mi->getParent();<br>  MachineFunction* mf=mbb->getParent();<br>  MachineBasicBlock* new_mbb=mf->CreateMachineBasicBlock(mbb->getBasicBlock());<br> <br>  MachineFunction::iterator mbb_it(mbb);<br>  mf->insert(mbb_it,new_mbb);<br>  new_mbb->splice(new_mbb->end(),mbb,mbb->begin(),mi);<br>}<br></div><div><br></div><div>Originally, mi is in BB. </div><div>(mi would be a call instruction)</div><div>(do not consider mi is a branch instruction) </div><div>BB --> BB1 , BB2  <br></div><div>Then, I split BB, mi is the first instruction of BB2.</div><div>And the instructions before mi are in BB1.</div><div><br></div><div></div><div>But now, I use  my machine function pass to compile some test programs.</div><div><br></div><div>And these test programs can't execute ,  always segment fault.</div><div> </div><div>Is there any problem in my split_mbb ?</div><div><br></div><div>How to "simply" split MachineBasicBlock ?</div><div><br></div><div>Thank you !!</div><div><br></div><div><br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>