[llvm] db58a9c - InstSimplify: Update another cannotBeOrderedLessThanZero use

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 05:15:13 PDT 2023


Author: Matt Arsenault
Date: 2023-07-07T08:15:09-04:00
New Revision: db58a9c03f66cba41da16bfc4e7089bafa53aff5

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

LOG: InstSimplify: Update another cannotBeOrderedLessThanZero use

Pass all the optional arguments to enable assumes.

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 aa8c179b114aa3..75c6d2b758dd94 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4220,7 +4220,7 @@ static Value *simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
     case FCmpInst::FCMP_OLT:
       // Positive or zero or nan X >= 0.0 --> true
       // Positive or zero or nan X <  0.0 --> false
-      if (CannotBeOrderedLessThanZero(LHS, Q.DL, Q.TLI))
+      if (cannotBeOrderedLessThanZero(LHS, Q.DL, Q.TLI, 0, Q.AC, Q.CxtI, Q.DT))
         return Pred == FCmpInst::FCMP_UGE ? getTrue(RetTy) : 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 2cdcdd82cf8e90..a88057e4d4d93e 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1502,8 +1502,7 @@ define i1 @fcmp_uge_0_assumed_oge_zero(float %x) {
 ; CHECK-LABEL: @fcmp_uge_0_assumed_oge_zero(
 ; CHECK-NEXT:    [[ASSUME_CMP:%.*]] = fcmp oge float [[X:%.*]], 0.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp uge float [[X]], 0.000000e+00
-; CHECK-NEXT:    ret i1 [[R]]
+; CHECK-NEXT:    ret i1 true
 ;
   %assume.cmp = fcmp oge float %x, 0.0
   call void @llvm.assume(i1 %assume.cmp)
@@ -1515,8 +1514,7 @@ define i1 @fcmp_olt_0_assumed_oge_zero(float %x) {
 ; CHECK-LABEL: @fcmp_olt_0_assumed_oge_zero(
 ; CHECK-NEXT:    [[ASSUME_CMP:%.*]] = fcmp oge float [[X:%.*]], 0.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ASSUME_CMP]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp olt float [[X]], 0.000000e+00
-; CHECK-NEXT:    ret i1 [[R]]
+; CHECK-NEXT:    ret i1 false
 ;
   %assume.cmp = fcmp oge float %x, 0.0
   call void @llvm.assume(i1 %assume.cmp)


        


More information about the llvm-commits mailing list