<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 7, 2012 at 7:55 PM, Michael Ilseman <span dir="ltr"><<a href="mailto:milseman@apple.com" target="_blank" class="cremed">milseman@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks for the comment. New patch attached. I'm not too familiar with SDValue/SDNode, so if you see a way that it can be cleaned up further, let me know!</div>
</blockquote><div><br></div><div>Hmm, I would have assumed (naively, and without running the compiler over it) that you could write this as:</div><div><br></div><div><div>      } else if (Opcode == ISD::FMUL) {</div><div>
        ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(N1);</div><div>        SDNode *Arg = N2;</div><div><br></div><div>        // If the first operand isn't the constant, try the second</div><div>        if (!CFP) {</div>
<div>          CFP = dyn_cast<ConstantFPSDNode>(N2);</div><div>          Arg = N1;</div><div>        }</div><div><br></div><div>        if (CFP) {</div><div>          // 0*x --> 0</div><div>          if (CFP->isZero())</div>
<div>            return CFP;</div><div>          // 1*x --> x</div><div>          if (CFP->isExactlyValue(1.0))</div><div>            return Arg;</div><div>        }</div></div><div><br></div><div>If that doesn't work, your version seems fine.</div>
</div></div>