[llvm] 13cf479 - ValueTracking: Use new version of cannotBeOrderedLessThanZero

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 16:26:36 PDT 2023


Author: Matt Arsenault
Date: 2023-06-23T19:26:30-04:00
New Revision: 13cf479dd125ada7fba6e36791e68e32d5c1f225

URL: https://github.com/llvm/llvm-project/commit/13cf479dd125ada7fba6e36791e68e32d5c1f225
DIFF: https://github.com/llvm/llvm-project/commit/13cf479dd125ada7fba6e36791e68e32d5c1f225.diff

LOG: ValueTracking: Use new version of cannotBeOrderedLessThanZero

Pass all arguments so now 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 48ffa83d45cee..d88e047e23283 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4147,7 +4147,8 @@ static Value *simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
       case FCmpInst::FCMP_OLE:
       case FCmpInst::FCMP_OLT:
         // (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 getFalse(RetTy);
         break;
       default:

diff  --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
index c2a046509d9a2..914c2d2eb61b9 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1153,8 +1153,7 @@ define i1 @assumed_positive_olt_with_negative_constant(double %a) {
 ; CHECK-LABEL: @assumed_positive_olt_with_negative_constant(
 ; CHECK-NEXT:    [[ASSUME_CMP:%.*]] = fcmp oge double [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp olt double [[A]], -1.000000e+00
-; CHECK-NEXT:    ret i1 [[CMP]]
+; CHECK-NEXT:    ret i1 false
 ;
   %assume.cmp = fcmp oge double %a, 0.0
   call void @llvm.assume(i1 %assume.cmp)
@@ -1166,8 +1165,7 @@ define i1 @assumed_positive_ole_with_negative_constant(double %a) {
 ; CHECK-LABEL: @assumed_positive_ole_with_negative_constant(
 ; CHECK-NEXT:    [[ASSUME_CMP:%.*]] = fcmp oge double [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp ole double [[A]], -1.000000e+00
-; CHECK-NEXT:    ret i1 [[CMP]]
+; CHECK-NEXT:    ret i1 false
 ;
   %assume.cmp = fcmp oge double %a, 0.0
   call void @llvm.assume(i1 %assume.cmp)
@@ -1179,8 +1177,7 @@ define i1 @assumed_positive_oeq_with_negative_constant(double %a) {
 ; CHECK-LABEL: @assumed_positive_oeq_with_negative_constant(
 ; CHECK-NEXT:    [[ASSUME_CMP:%.*]] = fcmp oge double [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq double [[A]], -1.000000e+00
-; CHECK-NEXT:    ret i1 [[CMP]]
+; CHECK-NEXT:    ret i1 false
 ;
   %assume.cmp = fcmp oge double %a, 0.0
   call void @llvm.assume(i1 %assume.cmp)


        


More information about the llvm-commits mailing list