<p dir="ltr">Try incrementing the iterator before using. </p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 5, 2016 10:26, "Simona Simona via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On Mon, Sep 5, 2016 at 3:20 AM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sun, Sep 4, 2016 at 1:06 PM, Simona Simona via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">Hello,<br><div class="gmail_quote"><div dir="ltr"><div><div><div><div><div><div><div><br></div>I'm trying to add a new instruction after a given instruction in a basic block.<br></div>Until LLVM 3.7, I was using the following code:<br><br> BB->getInstList().insertAfter(<wbr>I, new_inst);<br> [where both I and new_inst are Instruction*]<br></div><br></div>In LLVM 3.8 however, the SymbolTableList was created as a wrapper over iplist.<br></div>Could anyone please tell me how I can do the same type of insertion in LLVM 3.8?<br></div></div></div></div></div></blockquote><div><br></div></span><div> auto InsertPt = I->getIterator();</div><div> BB->getInstList().insert(Inse<wbr>rtPt, new_inst);</div><div><br></div></div></div></div>
</blockquote></div><br></div><div class="gmail_extra">Thanks, Daniel! <br><br>In your example, isn't "insert" inserting "new_inst" *before* instruction "I"? <br>As I would like to insert the "new_inst" instruction after "I", shouldn't it be <br> BB->getInstList().insertAfter(<wbr>InsertPt, new_inst); ?<br><br></div><div class="gmail_extra">With insert I currently get the following error:<br> Instruction does not dominate all uses! <br> %0 = getelementptr inbounds i8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i32 0, i32 0)<br> call void @myCall(i8* %0)<br><br></div><div class="gmail_extra">Regards,<br></div><div class="gmail_extra">Simona<br></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div></div>