[llvm] [WebAssembly] Fix missed optimization in 50142 (PR #144741)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 18 17:15:00 PDT 2025
================
@@ -3248,6 +3248,37 @@ static SDValue performSETCCCombine(SDNode *N,
ISD::CondCode Cond = cast<CondCodeSDNode>(N->getOperand(2))->get();
SDLoc DL(N);
EVT VT = N->getValueType(0);
+ // N LHS LhsL LhsLL LhsLR InnerCond RHS Cond
+ // setcc (iN (bitcast (setcc vNi1 (vNiY X), <vNiY 0>, eq)), 0, eq
+ // => all_true (vNi1 X)
+ if (DCI.isBeforeLegalize() && VT.isScalarInteger() && (Cond == ISD::SETEQ) &&
----------------
lukel97 wrote:
Looking at this combine its quite similar to the one below, I wonder if it could be generalized?
i.e. we could rely on the combine below to do the first half, and then we would add a combine for
`wasm_anytrue (sext/zext (setcc x, 0, eq)) -> not (wasm_alltrue x)`
and
`wasm_anytrue (sext/zext (setcc x, 0, ne)) -> wasm_alltrue x`
I think you'd have then do the combine on `ISD::INTRINSIC_WO_CHAIN`. But this is just an idea, it might turn out to be harder :)
https://github.com/llvm/llvm-project/pull/144741
More information about the llvm-commits
mailing list