[llvm] 481191b - Revert "InstSimplify: Pass AssumptionCache to isKnownNeverInfinity"
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 23:32:19 PDT 2023
Author: Alina Sbirlea
Date: 2023-05-18T23:31:50-07:00
New Revision: 481191b0a8318e55ce467e983d78d2141e827db1
URL: https://github.com/llvm/llvm-project/commit/481191b0a8318e55ce467e983d78d2141e827db1
DIFF: https://github.com/llvm/llvm-project/commit/481191b0a8318e55ce467e983d78d2141e827db1.diff
LOG: Revert "InstSimplify: Pass AssumptionCache to isKnownNeverInfinity"
This reverts commit 0012b94a4e8e0c757ef0adcd68fb61bb0318b26c.
Reverting due to test failures introduced by 73925ef8b0eacc6792f0e3ea21a3e6d51f5ee8b0
Updated floating-point-compare.ll to keep the assume declaration.
Added:
Modified:
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstCombine/pow-1.ll
llvm/test/Transforms/InstSimplify/floating-point-compare.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index c2c7929f69a8..e73b13f558ef 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4085,20 +4085,16 @@ static Value *simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
}
// LHS == Inf
- if (Pred == FCmpInst::FCMP_OEQ &&
- isKnownNeverInfinity(LHS, Q.DL, Q.TLI, 0, Q.AC, Q.CxtI, Q.DT))
+ if (Pred == FCmpInst::FCMP_OEQ && isKnownNeverInfinity(LHS, Q.DL, Q.TLI))
return getFalse(RetTy);
// LHS != Inf
- if (Pred == FCmpInst::FCMP_UNE &&
- isKnownNeverInfinity(LHS, Q.DL, Q.TLI, 0, Q.AC, Q.CxtI, Q.DT))
+ if (Pred == FCmpInst::FCMP_UNE && isKnownNeverInfinity(LHS, Q.DL, Q.TLI))
return getTrue(RetTy);
// LHS == Inf || LHS == NaN
- if (Pred == FCmpInst::FCMP_UEQ &&
- isKnownNeverInfOrNaN(LHS, Q.DL, Q.TLI, 0, Q.AC, Q.CxtI, Q.DT))
+ if (Pred == FCmpInst::FCMP_UEQ && isKnownNeverInfOrNaN(LHS, Q.DL, Q.TLI))
return getFalse(RetTy);
// LHS != Inf && LHS != NaN
- if (Pred == FCmpInst::FCMP_ONE &&
- isKnownNeverInfOrNaN(LHS, Q.DL, Q.TLI, 0, Q.AC, Q.CxtI, Q.DT))
+ if (Pred == FCmpInst::FCMP_ONE && isKnownNeverInfOrNaN(LHS, Q.DL, Q.TLI))
return getTrue(RetTy);
}
if (C->isNegative() && !C->isNegZero()) {
diff --git a/llvm/test/Transforms/InstCombine/pow-1.ll b/llvm/test/Transforms/InstCombine/pow-1.ll
index 16eca3d8f2d0..d1f587f7ce08 100644
--- a/llvm/test/Transforms/InstCombine/pow-1.ll
+++ b/llvm/test/Transforms/InstCombine/pow-1.ll
@@ -281,7 +281,9 @@ define float @powf_libcall_half_assume_ninf(float %x) {
; ANY-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X]])
; ANY-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
-; ANY-NEXT: ret float [[ABS]]
+; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
+; ANY-NEXT: [[RETVAL:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
+; ANY-NEXT: ret float [[RETVAL]]
;
; VC32-LABEL: define float @powf_libcall_half_assume_ninf
; VC32-SAME: (float [[X:%.*]]) {
@@ -306,7 +308,9 @@ define float @powf_libcall_half_assume_ninf(float %x) {
; VC64-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
; VC64-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X]])
; VC64-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
-; VC64-NEXT: ret float [[ABS]]
+; VC64-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
+; VC64-NEXT: [[RETVAL:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
+; VC64-NEXT: ret float [[RETVAL]]
;
; VC83-LABEL: define float @powf_libcall_half_assume_ninf
; VC83-SAME: (float [[X:%.*]]) {
@@ -315,7 +319,9 @@ define float @powf_libcall_half_assume_ninf(float %x) {
; VC83-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
; VC83-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X]])
; VC83-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
-; VC83-NEXT: ret float [[ABS]]
+; VC83-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
+; VC83-NEXT: [[RETVAL:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
+; VC83-NEXT: ret float [[RETVAL]]
;
; NOLIB-LABEL: define float @powf_libcall_half_assume_ninf
; NOLIB-SAME: (float [[X:%.*]]) {
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
index d004b7d4b38c..45918ed56056 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1150,34 +1150,6 @@ define i1 @is_infinite(float %x) {
ret i1 %r
}
-define i1 @is_infinite_assumed_finite(float %x) {
-; CHECK-LABEL: @is_infinite_assumed_finite(
-; CHECK-NEXT: [[XABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT: [[NOT_INF:%.*]] = fcmp one float [[XABS]], 0x7FF0000000000000
-; CHECK-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
-; CHECK-NEXT: ret i1 false
-;
- %xabs = call float @llvm.fabs.f32(float %x)
- %not.inf = fcmp one float %xabs, 0x7FF0000000000000
- call void @llvm.assume(i1 %not.inf)
- %r = fcmp oeq float %xabs, 0x7FF0000000000000
- ret i1 %r
-}
-
-define i1 @une_inf_assumed_not_inf(float %x) {
-; CHECK-LABEL: @une_inf_assumed_not_inf(
-; CHECK-NEXT: [[XABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT: [[NOT_INF:%.*]] = fcmp one float [[XABS]], 0x7FF0000000000000
-; CHECK-NEXT: call void @llvm.assume(i1 [[NOT_INF]])
-; CHECK-NEXT: ret i1 true
-;
- %xabs = call float @llvm.fabs.f32(float %x)
- %not.inf = fcmp one float %xabs, 0x7FF0000000000000
- call void @llvm.assume(i1 %not.inf)
- %r = fcmp une float %xabs, 0x7FF0000000000000
- ret i1 %r
-}
-
define <2 x i1> @is_infinite_neg(<2 x float> %x) {
; CHECK-LABEL: @is_infinite_neg(
; CHECK-NEXT: ret <2 x i1> zeroinitializer
@@ -1209,20 +1181,6 @@ define i1 @is_infinite_or_nan2(float %x) {
ret i1 %r
}
-define i1 @is_infinite_or_nan2_assume(float %x) {
-; CHECK-LABEL: @is_infinite_or_nan2_assume(
-; CHECK-NEXT: [[XABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT: [[IS_INF_OR_NAN:%.*]] = fcmp one float [[XABS]], 0x7FF0000000000000
-; CHECK-NEXT: call void @llvm.assume(i1 [[IS_INF_OR_NAN]])
-; CHECK-NEXT: ret i1 false
-;
- %xabs = call float @llvm.fabs.f32(float %x)
- %is.inf.or.nan = fcmp one float %xabs, 0x7FF0000000000000
- call void @llvm.assume(i1 %is.inf.or.nan)
- %r = fcmp ueq float %xabs, 0x7FF0000000000000
- ret i1 %r
-}
-
define <2 x i1> @is_infinite_neg_or_nan(<2 x float> %x) {
; CHECK-LABEL: @is_infinite_neg_or_nan(
; CHECK-NEXT: ret <2 x i1> zeroinitializer
@@ -1274,21 +1232,6 @@ define i1 @is_finite(i1 %c, double %x) {
ret i1 %r
}
-define i1 @is_finite_assume(i1 %c, double %x) {
-; CHECK-LABEL: @is_finite_assume(
-; CHECK-NEXT: [[XABS:%.*]] = call double @llvm.fabs.f64(double [[X:%.*]])
-; CHECK-NEXT: [[IS_INF_OR_NAN:%.*]] = fcmp one double [[XABS]], 0x7FF0000000000000
-; CHECK-NEXT: call void @llvm.assume(i1 [[IS_INF_OR_NAN]])
-; CHECK-NEXT: ret i1 true
-;
- %xabs = call double @llvm.fabs.f64(double %x)
- %is.inf.or.nan = fcmp one double %xabs, 0x7FF0000000000000
- call void @llvm.assume(i1 %is.inf.or.nan)
- %s = select i1 %c, double 42.0, double %x
- %r = fcmp one double %s, 0x7FF0000000000000
- ret i1 %r
-}
-
define <2 x i1> @is_finite_commute(<2 x i8> %x) {
; CHECK-LABEL: @is_finite_commute(
; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
More information about the llvm-commits
mailing list