File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
lib/Transforms/InstCombine
test/Transforms/InstCombine Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -886,15 +886,14 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
886
886
case Intrinsic::powi:
887
887
if (ConstantInt *Power = dyn_cast<ConstantInt>(II->getArgOperand (1 ))) {
888
888
// 0 and 1 are handled in instsimplify
889
-
890
889
// powi(x, -1) -> 1/x
891
890
if (Power->isMinusOne ())
892
- return BinaryOperator::CreateFDiv (ConstantFP::get (CI.getType (), 1.0 ),
893
- II->getArgOperand (0 ));
891
+ return BinaryOperator::CreateFDivFMF (ConstantFP::get (CI.getType (), 1.0 ),
892
+ II->getArgOperand (0 ), II );
894
893
// powi(x, 2) -> x*x
895
894
if (Power->equalsInt (2 ))
896
- return BinaryOperator::CreateFMul (II->getArgOperand (0 ),
897
- II->getArgOperand (0 ));
895
+ return BinaryOperator::CreateFMulFMF (II->getArgOperand (0 ),
896
+ II->getArgOperand (0 ), II );
898
897
}
899
898
break ;
900
899
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ declare double @llvm.nearbyint.f64(double %Val) nounwind readonly
22
22
23
23
define void @powi (double %V , double *%P ) {
24
24
; CHECK-LABEL: @powi(
25
- ; CHECK-NEXT: [[A:%.*]] = fdiv double 1.000000e+00, [[V:%.*]]
25
+ ; CHECK-NEXT: [[A:%.*]] = fdiv fast double 1.000000e+00, [[V:%.*]]
26
26
; CHECK-NEXT: store volatile double [[A]], double* [[P:%.*]], align 8
27
- ; CHECK-NEXT: [[D:%.*]] = fmul double [[V]], [[V]]
27
+ ; CHECK-NEXT: [[D:%.*]] = fmul nnan double [[V]], [[V]]
28
28
; CHECK-NEXT: store volatile double [[D]], double* [[P]], align 8
29
29
; CHECK-NEXT: ret void
30
30
;
You can’t perform that action at this time.
0 commit comments