[PATCH] D144571: [DAGCombine] Fix an ICE in combineMinNumMaxNum(...)
Cameron McInally via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 10:24:56 PST 2023
cameron.mcinally updated this revision to Diff 499576.
cameron.mcinally added a comment.
Updated patch for Matt's reviews...
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144571/new/
https://reviews.llvm.org/D144571
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
Index: llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
@@ -0,0 +1,20 @@
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skylake
+
+; Checking for a DAGCombine ICE.
+
+define float @test_combinemaxnum(float %sub) #0 {
+L.entry:
+ %maxnum1 = call float @llvm.maxnum.f32(float 0.000000e+00, float 0.000000e+00)
+ br label %L.LB21_850
+
+L.LB21_850:
+ %neg1 = fneg fast float %maxnum1
+ %neg2 = fneg fast float %sub
+ %mask = fcmp fast ule float %maxnum1, %neg2
+ %maxnum2 = select i1 %mask, float %neg1, float %sub
+ ret float %maxnum2
+}
+
+declare dso_local float @llvm.maxnum.f32(float, float)
+
+attributes #0 = { "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" }
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -10815,7 +10815,8 @@
if (NegRHS == False) {
SDValue Combined = combineMinNumMaxNumImpl(DL, VT, LHS, RHS, NegTrue,
False, CC, TLI, DAG);
- return DAG.getNode(ISD::FNEG, DL, VT, Combined);
+ if (Combined)
+ return DAG.getNode(ISD::FNEG, DL, VT, Combined);
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144571.499576.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230222/e8cafdf3/attachment.bin>
More information about the llvm-commits
mailing list