Ah, I see. This is my instruction:<br><br>%<a href="http://lsr.iv125.us.ph">lsr.iv125.us.ph</a> = phi i32 [ %<a href="http://lsr.iv.next126.us">lsr.iv.next126.us</a>, %<a href="http://limit.exit281.i.us">limit.exit281.i.us</a> ], [ sub (i32 0, i32 ptrtoint ([8 x [2 x i32]]* @Maxlogmap_Decode_next_state to i32)), %<a href="http://for.cond195.preheader.i.us">for.cond195.preheader.i.us</a> ]<br>
<br>So there is a ptrtoint inside a sub inside a phi. <br><br>I'm just going to write a pass that promotes/demotes the embedded instr, shouldn't take long.<br><br>Thanks,<br><br><br><br><div class="gmail_quote">On Thu, Sep 20, 2012 at 3:33 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Sep 20, 2012 at 3:18 PM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:<br>

> Curious, is there a pass/mechanism that exists to promote an instruction<br>
> that is a value of a PHI?<br>
><br>
> For example, if one of the incoming values is a sub(x, y) from BB2, does<br>
> there exist something to promote this instruction back to BB2 (such that tmp<br>
> = sub(x,y)) and the PHI replaces the sub instr with tmp?<br>
><br>
> Or is the above the natural state that is then optimized into using sub, is<br>
> there a call that does this that I can turn off?<br>
<br>
</div></div>It sounds like you're talking about a ConstantExpr.  Those don't<br>
normally get lowered until CodeGen.  You could expand it at the IR<br>
level, but there isn't any builtin function to do that IIRC.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span></blockquote></div><br>