<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 21, 2012, at 7:21 PM, Rafael Espindola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:</div><blockquote type="cite"><div><font color="#000000"><br></font>-          // If the cast isn't where we want it, fix it.<br>-          if (BasicBlock::iterator(CI) != IP) {<br>+          // If the cast isn't where we want it or if it doesn't dominate<br>+          // a use in BIP, fix it.<br>+          if (BasicBlock::iterator(CI) != IP || BIP == IP) {<br>             // Create a new cast, and leave the old cast in place in case<br>             // it is being used as an insert point. Clear its operand<br>             // so that it doesn't hold anything live.<br></div></blockquote></div><br><div>Great!</div><div><br></div><div>Given the amount of time I spent during review trying to remember why I originally added that check. We should probably be more explicit in the comments. Something like:</div><div><br></div><div>"If the cast isn't where we want it, create a new, earlier cast at IP. Likewise, do not reuse a cast at BIP because it must dominate instructions that will be inserted before BIP."</div><div><br></div><div>-Andy</div></body></html>