[llvm-commits] [PATCH][Instcombine, FAST-MATH] Some enhancement to Fmul
evan.cheng at apple.com
Wed Jan 2 19:21:00 PST 2013
Sent from my iPad
On Jan 2, 2013, at 5:53 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Wed, Jan 2, 2013 at 5:48 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
>> Canonicalization will help if one of the operands is constant.
> And in both of these patches, the optimizations only trigger when one of the operands is constant.
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.
>> Otherwise, its meaning is pretty vague. Consider the the case "(select c ? v1 : v2) * (m + n)", which form is canonical?
>> (select ...) * (.. + ... ) or "(..+...) * (select ...)?
> 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.
Canonicalization is not required for every form of expressions. I would follow what's there for integer expressions.
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits