[llvm] [SelectionDAG] Fix incorrect fold condition in foldSetCCWithFunnelShift. (PR #137637)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Fri May 2 07:26:25 PDT 2025
================
@@ -4462,7 +4462,11 @@ static SDValue foldSetCCWithFunnelShift(EVT VT, SDValue N0, SDValue N1,
unsigned BitWidth = N0.getScalarValueSizeInBits();
auto *ShAmtC = isConstOrConstSplat(N0.getOperand(2));
- if (!ShAmtC || ShAmtC->getAPIntValue().uge(BitWidth))
+ if (!ShAmtC)
+ return SDValue();
+
+ APInt AmtVal = ShAmtC->getAPIntValue();
+ if (AmtVal.uge(BitWidth) || AmtVal.isZero())
return SDValue();
----------------
davemgreen wrote:
>From my point of view - just because it should not come up from non-canonical code IIUC, and so fixing the bug is the more important issue and trying to handle other cases that could lead to further bugs for little benefit. But it sounds OK so long as the rest of the code handles it correctly.
https://github.com/llvm/llvm-project/pull/137637
More information about the llvm-commits
mailing list