[PATCH] D41608: [InstCombine] Missed optimization in math expression: aggressive optimization with pow

Dmitry Venikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 11:02:21 PST 2018


Quolyk marked an inline comment as not done.
Quolyk added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:713
+                                           Intrinsic::pow, I.getType());
+    // pow(A, B) * A -> pow(A, B+1)
+    if (match(Op0, m_Intrinsic<Intrinsic::pow>(m_Value(A0), m_Value(B0))) &&
----------------
spatel wrote:
> spatel wrote:
> > Need to handle commuted versions too (please add a test):
> > 
> > ```
> > define double @pow_ab_x_a_fast_commute(double %a, double %b)  {
> >   %c = fdiv double 1.0, %a  ; defeat complexity-based canonicalization of operands
> >   %p = call fast double @llvm.pow.f64(double %a, double %b)
> >   %mul = fmul fast double %c, %p
> >   ret double %mul
> > }
> > 
> > ```
> This comment was marked 'Done', but I don't see code to account for this or the test that I suggested.
My bad, I thought fdiv_pow_ab_a test would be enough.


https://reviews.llvm.org/D41608





More information about the llvm-commits mailing list