@@ -545,15 +545,16 @@ template <typename T0, typename T1> struct SDShuffle_match {
545545 T0 Op1;
546546 T1 Op2;
547547
548- const ArrayRef<int > *MaskRef ;
548+ ArrayRef<int > &CapturedMask ;
549549
550550 // capturing mask
551- SDShuffle_match (const T0 &Op1, const T1 &Op2, const ArrayRef<int > &MaskRef)
552- : Op1(Op1), Op2(Op2), MaskRef(& MaskRef) {}
551+ SDShuffle_match (const T0 &Op1, const T1 &Op2, ArrayRef<int > &MaskRef)
552+ : Op1(Op1), Op2(Op2), CapturedMask( MaskRef) {}
553553
554554 template <typename MatchContext>
555555 bool match (const MatchContext &Ctx, SDValue N) {
556556 if (auto *I = dyn_cast<ShuffleVectorSDNode>(N)) {
557+ CapturedMask = I->getMask ();
557558 return Op1.match (Ctx, I->getOperand (0 )) &&
558559 Op2.match (Ctx, I->getOperand (1 ));
559560 }
@@ -567,14 +568,16 @@ template <typename T0, typename T1> struct SDShuffle_maskMatch {
567568 T1 Op2;
568569 ArrayRef<int > SpecificMask;
569570
570- SDShuffle_maskMatch (const T0 &Op1, const T1 &Op2, const ArrayRef<int > Mask)
571+ SDShuffle_maskMatch (const T0 &Op1, const T1 &Op2, ArrayRef<int > Mask)
571572 : Op1(Op1), Op2(Op2), SpecificMask(Mask) {}
572573
573574 template <typename MatchContext>
574575 bool match (const MatchContext &Ctx, SDValue N) {
575576 if (auto *I = dyn_cast<ShuffleVectorSDNode>(N)) {
576577 return Op1.match (Ctx, I->getOperand (0 )) &&
577- Op2.match (Ctx, I->getOperand (1 )) && I->getMask () == SpecificMask;
578+ Op2.match (Ctx, I->getOperand (1 )) &&
579+ std::equal (SpecificMask.begin (), SpecificMask.end (),
580+ I->getMask ().begin (), I->getMask ().end ());
578581 }
579582 return false ;
580583 }
@@ -831,14 +834,13 @@ inline BinaryOpc_match<LHS, RHS> m_FRem(const LHS &L, const RHS &R) {
831834
832835template <typename V1_t, typename V2_t>
833836inline SDShuffle_match<V1_t, V2_t> m_Shuffle (const V1_t &v1, const V2_t &v2,
834- const ArrayRef<int > &maskRef ) {
835- return SDShuffle_match<V1_t, V2_t>(v1, v2, maskRef );
837+ ArrayRef<int > &mask ) {
838+ return SDShuffle_match<V1_t, V2_t>(v1, v2, mask );
836839}
837840
838841template <typename V1_t, typename V2_t>
839842inline SDShuffle_maskMatch<V1_t, V2_t>
840- m_ShuffleSpecificMask (const V1_t &v1, const V2_t &v2,
841- const ArrayRef<int > mask) {
843+ m_ShuffleSpecificMask (const V1_t &v1, const V2_t &v2, ArrayRef<int > mask) {
842844 return SDShuffle_maskMatch<V1_t, V2_t>(v1, v2, mask);
843845}
844846
0 commit comments