[llvm] [InstCombine] Generalise optimisation of redundant floating point comparisons with `ConstantFPRange` (PR #159315)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 20 03:44:57 PDT 2025


================
@@ -115,21 +115,18 @@ define i1 @or_fcmp_redundant_and4(double %v0) {
   ret i1 %v3
 }
 
-define i1 @or_fcmp_redundant_and_neg1(double %v0) {
-; CHECK-LABEL: @or_fcmp_redundant_and_neg1(
-; CHECK-NEXT:    [[V1:%.*]] = fcmp olt double [[V0:%.*]], 1.000000e-02
-; CHECK-NEXT:    [[V2:%.*]] = fcmp ogt double [[V0]], 1.990000e+00
-; CHECK-NEXT:    [[V3:%.*]] = and i1 [[V1]], [[V2]]
-; CHECK-NEXT:    ret i1 [[V3]]
+define i1 @or_fcmp_redundant_and_5(double %v0) {
+; CHECK-LABEL: @or_fcmp_redundant_and_5(
+; CHECK-NEXT:    ret i1 false
 ;
   %v1 = fcmp olt double %v0, 1.000000e-02
   %v2 = fcmp ogt double %v0, 1.990000e+00
   %v3 = and i1 %v1, %v2
   ret i1 %v3
 }
 
-define i1 @or_fcmp_redundant_and_neg2(double %v0) {
-; CHECK-LABEL: @or_fcmp_redundant_and_neg2(
+define i1 @or_fcmp_redundant_and_6(double %v0) {
----------------
dtcxzyw wrote:

It is still a negative test.

https://github.com/llvm/llvm-project/pull/159315


More information about the llvm-commits mailing list