forked from OSchip/llvm-project
[InstCombine] Add test case for PR43617 (NFC)
Also, refactor check in `LibCallSimplifier::optimizeLog()`. llvm-svn: 374453
This commit is contained in:
parent
8d0744a8b5
commit
8bd4276981
|
@ -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);
|
||||
|
||||
|
|
|
@ -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>)
|
||||
|
|
Loading…
Reference in New Issue