<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPad</div><div><br>On Jan 2, 2013, at 5:53 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr"><div class="gmail_extra">On Wed, Jan 2, 2013 at 5:48 PM, Shuxin Yang <span dir="ltr"><<a href="mailto:shuxin.llvm@gmail.com" target="_blank" class="cremed">shuxin.llvm@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">Canonicalization will help if one of the operands is constant. <br>
</div></blockquote><div><br></div><div style="">And in both of these patches, the optimizations only trigger when one of the operands is constant.</div></div></div></div></div></div></blockquote><div><br></div>I agree. LLVM, both optimizer and codegen, canonicalize integer binary expression so the constant is the second operand. We should do the same for fp expression if allowed. <div><br><blockquote type="cite"><div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    Otherwise, its meaning is pretty vague.  Consider the the case
    "(select c ? v1 : v2) * (m + n)", which form is canonical? <br>
       (select ...) * (.. + ... ) or "(..+...) * (select ...)?</div></blockquote><div><br></div><div style="">Even here, I think it is fundamentally the right architecture to pick a canonical form and rewrite to that form. If we get it wrong, it is easy to fix. The codegen layer should reorder things however is best on the architecture regardless of the particular ordering we canonicalize to in the IR. The point of canonicalization is not that one form is "better" than another, but merely to constrain the search space and improve our ability to match patterns consistently.</div>
</div></div></div></div>
</div></blockquote><div><br></div><div>Canonicalization is not required for every form of expressions. I would follow what's there for integer expressions. </div><div><br></div><div>Evan</div><div><br></div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>llvm-commits mailing list</span><br><span><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a></span><br><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></span><br></div></blockquote></div></body></html>