[llvm] 708fa7d - ValueTracking: Update a use of cannotBeOrderedLessThanZero
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 04:33:57 PDT 2023
Author: Matt Arsenault
Date: 2023-07-07T07:33:48-04:00
New Revision: 708fa7d926fc0015b8b7a2b607a1f6753c3ecb3e
URL: https://github.com/llvm/llvm-project/commit/708fa7d926fc0015b8b7a2b607a1f6753c3ecb3e
DIFF: https://github.com/llvm/llvm-project/commit/708fa7d926fc0015b8b7a2b607a1f6753c3ecb3e.diff
LOG: ValueTracking: Update a use of cannotBeOrderedLessThanZero
Makes assumes work.
Added:
Modified:
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/floating-point-compare.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 8599847dddb5e7..b3abaf213b2e8d 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4138,7 +4138,8 @@ static Value *simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
case FCmpInst::FCMP_UGT:
case FCmpInst::FCMP_UNE:
// (X >= 0) implies (X > C) when (C < 0)
- if (CannotBeOrderedLessThanZero(LHS, Q.DL, Q.TLI))
+ if (cannotBeOrderedLessThanZero(LHS, Q.DL, Q.TLI, 0,
+ Q.AC, Q.CxtI, Q.DT))
return getTrue(RetTy);
break;
case FCmpInst::FCMP_OEQ:
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
index 914c2d2eb61b99..8ac2b341088cb0 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1207,8 +1207,7 @@ define i1 @assumed_positive_ugt_with_negative_constant(float %a) {
; CHECK-LABEL: @assumed_positive_ugt_with_negative_constant(
; CHECK-NEXT: [[ASSUME_CMP:%.*]] = fcmp ogt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT: [[CMP:%.*]] = fcmp ugt float [[A]], -3.000000e+00
-; CHECK-NEXT: ret i1 [[CMP]]
+; CHECK-NEXT: ret i1 true
;
%assume.cmp = fcmp ogt float %a, 0.0
call void @llvm.assume(i1 %assume.cmp)
@@ -1220,8 +1219,7 @@ define i1 @assumed_positive_uge_with_negative_constant(float %a) {
; CHECK-LABEL: @assumed_positive_uge_with_negative_constant(
; CHECK-NEXT: [[ASSUME_CMP:%.*]] = fcmp ogt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT: [[CMP:%.*]] = fcmp uge float [[A]], -3.000000e+00
-; CHECK-NEXT: ret i1 [[CMP]]
+; CHECK-NEXT: ret i1 true
;
%assume.cmp = fcmp ogt float %a, 0.0
call void @llvm.assume(i1 %assume.cmp)
@@ -1233,8 +1231,7 @@ define i1 @assumed_positive_une_with_negative_constant(float %a) {
; CHECK-LABEL: @assumed_positive_une_with_negative_constant(
; CHECK-NEXT: [[ASSUME_CMP:%.*]] = fcmp ogt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT: [[CMP:%.*]] = fcmp une float [[A]], -3.000000e+00
-; CHECK-NEXT: ret i1 [[CMP]]
+; CHECK-NEXT: ret i1 true
;
%assume.cmp = fcmp ogt float %a, 0.0
call void @llvm.assume(i1 %assume.cmp)
More information about the llvm-commits
mailing list