@@ -3247,10 +3247,18 @@ static SDValue performAnyAllCombine(SDNode *N, SelectionDAG &DAG) {
3247
3247
// all_true (setcc <X>, 0, ne) => (all_true X)
3248
3248
assert (N->getOpcode () == ISD::INTRINSIC_WO_CHAIN);
3249
3249
using namespace llvm ::SDPatternMatch;
3250
- SDLoc DL (N);
3251
- auto CombineSetCC =
3252
- [&N, &DAG, &DL](Intrinsic::WASMIntrinsics InPre, ISD::CondCode SetType,
3253
- Intrinsic::WASMIntrinsics InPost) -> SDValue {
3250
+
3251
+ SDValue LHS;
3252
+ if (!sd_match (N->getOperand (1 ),
3253
+ m_c_SetCC (m_Value (LHS), m_Zero (), m_CondCode ())))
3254
+ return SDValue ();
3255
+ EVT LT = LHS.getValueType ();
3256
+ if (LT.getScalarSizeInBits () > 128 / LT.getVectorNumElements ())
3257
+ return SDValue ();
3258
+
3259
+ auto CombineSetCC = [&N, &DAG](Intrinsic::WASMIntrinsics InPre,
3260
+ ISD::CondCode SetType,
3261
+ Intrinsic::WASMIntrinsics InPost) {
3254
3262
if (N->getConstantOperandVal (0 ) != InPre)
3255
3263
return SDValue ();
3256
3264
@@ -3259,11 +3267,7 @@ static SDValue performAnyAllCombine(SDNode *N, SelectionDAG &DAG) {
3259
3267
m_SpecificCondCode (SetType))))
3260
3268
return SDValue ();
3261
3269
3262
- EVT LT = LHS.getValueType ();
3263
- unsigned NumElts = LT.getVectorNumElements ();
3264
- if (LT.getScalarSizeInBits () > 128 / NumElts)
3265
- return SDValue ();
3266
-
3270
+ SDLoc DL (N);
3267
3271
SDValue Ret = DAG.getZExtOrTrunc (
3268
3272
DAG.getNode (ISD::INTRINSIC_WO_CHAIN, DL, MVT::i32 ,
3269
3273
{DAG.getConstant (InPost, DL, MVT::i32 ), LHS}),
0 commit comments