[llvm] [WebAssembly] Fold any/alltrue (setcc x, 0, eq/ne) to [not] any/alltrue x (PR #144741)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 30 02:38:32 PDT 2025
================
@@ -3239,6 +3240,55 @@ static SDValue performBitcastCombine(SDNode *N,
return SDValue();
}
+static SDValue performAnyAllCombine(SDNode *N, SelectionDAG &DAG) {
+ // any_true (setcc <X>, 0, eq) => (not (all_true X))
+ // all_true (setcc <X>, 0, eq) => (not (any_true X))
+ // any_true (setcc <X>, 0, ne) => (any_true X)
+ // all_true (setcc <X>, 0, ne) => (all_true X)
+ assert(N->getOpcode() == ISD::INTRINSIC_WO_CHAIN);
+ using namespace llvm::SDPatternMatch;
+ SDLoc DL(N);
+ static auto SimdCombiner =
+ [&](Intrinsic::WASMIntrinsics InPre, ISD::CondCode SetType,
----------------
lukel97 wrote:
It's better to explicitly capture what you need, e.g.
```suggestion
[&N, &DAG](Intrinsic::WASMIntrinsics InPre, ISD::CondCode SetType,
```
https://github.com/llvm/llvm-project/pull/144741
More information about the llvm-commits
mailing list