<div dir="ltr"><div>Hi,<br></div><div>I need to insert new instruction into every basic block like x=1<br></div><div>or while loop<br></div><div>I tried this code, but it doesn't work<br><br>Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext());<br>
AllocaInst* newInst = new AllocaInst(Int32Type,"flag", Bb);<br> Bb->getInstList().push_back(newInst);<br><br>the error:<br>void llvm::SymbolTableListTraits<llvm::Instruction, llvm::BasicBlock>::addNodeToList(ValueSubClass *) [ValueSubClass = llvm::Instruction, ItemParentClass = llvm::BasicBlock]: Assertion `V->getParent() == 0 && "Value already in a container!!"' failed.<br>
<br></div><div> Is there a class I could use to insert while loop in Module Pass?<br></div><div><br></div><div>Thank you in advance<br clear="all"></div><div><br>-- <br><div dir="ltr"><b style="color:rgb(32,18,77)"><span> </span>Rasha Salah Omar<br>
<span> </span> Msc Student at E-JUST<br><span> </span> Demonestrator at Faculty of Computers and Informatics<br><span> </span> Benha University</b>
<p style="color:rgb(32,18,77);font-size:13px;font-family:arial,helvetica,clean,sans-serif;background-color:transparent;font-style:normal"><b><span> e-mail: <a href="mailto:rasha.omar@ejust.edu.eg" target="_blank">rasha.omar@ejust.edu.eg</a></span></b></p>
<font size="4"><span style="font-family:Arial,Helvetica,sans-serif;font-size:12px;border-collapse:collapse;color:rgb(69,69,69)"><div style="padding:0px;display:block;line-height:normal">
<span style="font-size:20pt;color:rgb(0,176,80);font-family:Webdings">P</span><b><span style="font-size:11pt;color:rgb(0,176,80);font-family:sans-serif"> Please consider the environment before printing this email.</span></b></div>
</span></font><br></div>
</div></div>