[PATCH] D41940: [InstSimplify] Missed optimization in math expression: log10(pow(10.0, x)) == x, log2(pow(2.0, x)) == x

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 12:10:36 PST 2019


spatel added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:4944
+        (match(Op0, m_Intrinsic<Intrinsic::exp2>(m_Value(X))) ||
+         match(Op0, m_Intrinsic<Intrinsic::pow>(m_SpecificFP(2.0),
+                                                m_Value(X))))) return X;
----------------
Quolyk wrote:
> lebedev.ri wrote:
> > Hmm, do we want to canonicalize `Intrinsic::pow(2.0, x)` to `exp2(x)` instead ?
> If `Intrinsic::pow(2.0, x)` to `exp2(x)` transform is useful somewhere else or you have strong opinion about it we do. Otherwise I don't see the reason for this.
It's a specialized form of the more general math function, so we can assume it has a faster implementation. I think we should add that fold and reduce this patch.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D41940/new/

https://reviews.llvm.org/D41940





More information about the llvm-commits mailing list