[llvm] [InstCombine] Relax guard against FP min/max in select fold (PR #143144)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 08:15:00 PDT 2025
================
@@ -268,3 +268,14 @@ define i1 @test_fcmp_select_var_const_unordered(double %x, double %y) {
%cmp2 = fcmp ugt double %sel, 0x3E80000000000000
ret i1 %cmp2
}
+
+define i1 @test_fcmp_ord_select_fcmp_oeq_var_const(double %x) {
+; CHECK-LABEL: @test_fcmp_ord_select_fcmp_oeq_var_const(
+; CHECK-NEXT: [[CMP1:%.*]] = fcmp oeq double [[X:%.*]], 0.000000e+00
----------------
dtcxzyw wrote:
```suggestion
; CHECK-NEXT: [[CMP1:%.*]] = fcmp oeq double [[X:%.*]], 1.000000e+00
```
******************** TEST 'LLVM :: Transforms/InstCombine/fcmp-select.ll' FAILED ********************
Exit Code: 1
Command Output (stderr):
--
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fcmp-select.ll -passes=instcombine -S | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fcmp-select.ll # RUN: at line 2
+ /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=instcombine -S
+ /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fcmp-select.ll
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fcmp-select.ll:274:15: error: CHECK-NEXT: expected string not found in input
; CHECK-NEXT: [[CMP1:%.*]] = fcmp oeq double [[X:%.*]], 0.000000e+00
^
<stdin>:135:52: note: scanning from here
define i1 @test_fcmp_ord_select_fcmp_oeq_var_const(double %x) {
^
<stdin>:136:2: note: possible intended match here
%1 = fcmp oeq double %x, 1.000000e+00
^
Input file: <stdin>
Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/fcmp-select.ll
-dump-input=help explains the following input dump.
Input was:
<<<<<<
.
.
.
130: %1 = fcmp ugt double %y, 0x3E80000000000000
131: %cmp2 = select i1 %cmp1, i1 %1, i1 false
132: ret i1 %cmp2
133: }
134:
135: define i1 @test_fcmp_ord_select_fcmp_oeq_var_const(double %x) {
next:274'0 X~~~~~~~~~~~~ error: no match found
136: %1 = fcmp oeq double %x, 1.000000e+00
next:274'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:274'1 ? possible intended match
137: ret i1 %1
next:274'0 ~~~~~~~~~~~
138: }
next:274'0 ~~
139:
next:274'0 ~
140: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
next:274'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141: declare double @llvm.maxnum.f64(double, double) #0
next:274'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
.
.
>>>>>>
--
********************
https://github.com/llvm/llvm-project/pull/143144
More information about the llvm-commits
mailing list