<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>