summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2019-07-11 10:55:04 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2019-07-11 10:55:04 +0000
commite23be09e66d6860ec739b57d7821a7671d715a35 (patch)
treeeef4da51bea1bb7b36c6667e8903b8616188aab5 /llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
parent3b9994615f484d028ab476cf31bf6e62558364e8 (diff)
downloadbcm5719-llvm-e23be09e66d6860ec739b57d7821a7671d715a35.tar.gz
bcm5719-llvm-e23be09e66d6860ec739b57d7821a7671d715a35.zip
[InstCombine] Reorder recently added/improved pow transformations
Changed cases are now faster with exp2. llvm-svn: 365758
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index b481d2b50a8..bc55e77c44f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1471,6 +1471,9 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilder<> &B) {
if (match(Base, m_FPOne()))
return Base;
+ if (Value *Exp = replacePowWithExp(Pow, B))
+ return Exp;
+
// powf(x, sitofp(e)) -> powi(x, e)
// powf(x, uitofp(e)) -> powi(x, e)
if (AllowApprox && (isa<SIToFPInst>(Expo) || isa<UIToFPInst>(Expo))) {
@@ -1486,9 +1489,6 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilder<> &B) {
return createPowWithIntegerExponent(Base, NewExpo, M, B);
}
- if (Value *Exp = replacePowWithExp(Pow, B))
- return Exp;
-
// Evaluate special cases related to the exponent.
// pow(x, -1.0) -> 1.0 / x
OpenPOWER on IntegriCloud