summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp4
-rw-r--r--llvm/test/Transforms/InstCombine/log-pow.ll10
2 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index beb0d307c26..361b559ac02 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1915,9 +1915,7 @@ Value *LibCallSimplifier::optimizeLog(CallInst *Log, IRBuilder<> &B) {
IRBuilder<>::FastMathFlagGuard Guard(B);
B.setFastMathFlags(FastMathFlags::getFast());
- Function *ArgFn = Arg->getCalledFunction();
- Intrinsic::ID ArgID =
- ArgFn ? ArgFn->getIntrinsicID() : Intrinsic::not_intrinsic;
+ Intrinsic::ID ArgID = Arg->getIntrinsicID();
LibFunc ArgLb = NotLibFunc;
TLI->getLibFunc(Arg, ArgLb);
diff --git a/llvm/test/Transforms/InstCombine/log-pow.ll b/llvm/test/Transforms/InstCombine/log-pow.ll
index b7085e955ef..227fcf0c3fa 100644
--- a/llvm/test/Transforms/InstCombine/log-pow.ll
+++ b/llvm/test/Transforms/InstCombine/log-pow.ll
@@ -97,8 +97,18 @@ define double @log_exp2_not_fast(double %x) {
ret double %log
}
+define double @pr43617(double %d, i32 %i, double (i32)* %f) {
+entry:
+ %sub = fsub double -0.000000e+00, %d
+ %icall = tail call fast double %f(i32 %i)
+ %log = tail call fast double @llvm.log.f64(double %icall)
+ %mul = fmul double %log, %sub
+ ret double %mul
+}
+
declare double @log(double) #0
declare float @logf(float) #0
+declare double @llvm.log.f64(double) #0
declare <2 x float> @llvm.log.v2f32(<2 x float>)
declare float @log2f(float) #0
declare <2 x double> @llvm.log2.v2f64(<2 x double>)
OpenPOWER on IntegriCloud