<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 11, 2015, at 3:04 PM, Chris Sears <<a href="mailto:chris.sears@gmail.com" class="">chris.sears@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I made the change to the BuildMI() call. Again, I don't think that matters.<div class=""><br class=""></div><div class=""><div class="">#define BUILD_INS(opcode, new_reg, i) \</div><div class=""> BuildMI(*MBB, OldMI, MBBI->getDebugLoc(), TII->get(X86::opcode)) \</div><div class=""> .addReg(X86::new_reg, kill).addImm(i)</div></div><div class=""><br class=""></div><div class="">I didn't completely understand your other proposed change:</div><div class=""><span class="im" style="font-size:12.8000001907349px"> for (MachineBasicBlock::iterator MBBI = MBB->begin();<br class=""></span><span style="font-size:12.8000001907349px" class=""> MBBI != MBB->end(); ) {</span><br style="font-size:12.8000001907349px" class=""><span class="im" style="font-size:12.8000001907349px"> MachineInstr *NewMI = NULL;<br class=""> OldMI = MBBI;<br class=""></span><span style="font-size:12.8000001907349px" class=""> ++MBBI;</span></div><div class=""><span style="font-size:12.8000001907349px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8000001907349px" class="">I think you're saying with </span><span style="font-size:12.8000001907349px" class="">++MBBI</span><span style="font-size:12.8000001907349px" class=""> to step past the old instruction.</span></div><div class=""><span style="font-size:12.8000001907349px" class="">This seems faster speedwise but more of a hack than just restarting the loop.</span></div><div class=""><span style="font-size:12.8000001907349px" class="">But I'll try it. It implies a certain knowledge of the iterator and MBB.</span></div></div></div></blockquote><div><br class=""></div><div>I don’t see this is as a hack.</div><div>I believe it is a widespread pattern when iterating on a linked-list and having to delete elements.</div><div>You’ll see this pattern everywhere in LLVM.</div><div><br class=""></div><div>Mehdi</div><div><br class=""></div></div></body></html>