[llvm] r374453 - [InstCombine] Add test case for PR43617 (NFC)
Evandro Menezes via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 14:29:10 PDT 2019
Author: evandro
Date: Thu Oct 10 14:29:10 2019
New Revision: 374453
URL: http://llvm.org/viewvc/llvm-project?rev=374453&view=rev
Log:
[InstCombine] Add test case for PR43617 (NFC)
Also, refactor check in `LibCallSimplifier::optimizeLog()`.
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/trunk/test/Transforms/InstCombine/log-pow.ll
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=374453&r1=374452&r2=374453&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Thu Oct 10 14:29:10 2019
@@ -1915,9 +1915,7 @@ Value *LibCallSimplifier::optimizeLog(Ca
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);
Modified: llvm/trunk/test/Transforms/InstCombine/log-pow.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/log-pow.ll?rev=374453&r1=374452&r2=374453&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/log-pow.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/log-pow.ll Thu Oct 10 14:29:10 2019
@@ -97,8 +97,18 @@ define double @log_exp2_not_fast(double
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>)
More information about the llvm-commits
mailing list