[llvm] Add SD matchers and unit test coverage for ISD::VECTOR_SHUFFLE (PR #119592)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 24 13:37:32 PST 2024


================
@@ -133,13 +134,11 @@ TEST_F(SelectionDAGPatternMatchTest, matchVecShuffle) {
       DAG->getVectorShuffle(VInt32VT, DL, V0, V1, MaskData);
 
   using namespace SDPatternMatch;
+  EXPECT_TRUE(sd_match(VecShuffleWithMask, m_Shuffle(m_Value(), m_Value())));
   EXPECT_TRUE(sd_match(VecShuffleWithMask,
-                       m_Shuffle(m_Value(), m_Value(), CapturedMask)));
+                       m_Shuffle(m_Value(), m_Value(), m_Mask(CapturedMask))));
   EXPECT_TRUE(sd_match(VecShuffleWithMask,
-                       m_ShuffleSpecificMask(m_Value(), m_Value(), MaskData)));
-  EXPECT_FALSE(
-      sd_match(VecShuffleWithMask,
-               m_ShuffleSpecificMask(m_Value(), m_Value(), OtherMaskData)));
+                       m_Shuffle(m_Value(), m_Value(), m_SpecificMask(Mask))));
   EXPECT_TRUE(std::equal(MaskData.begin(), MaskData.end(), CapturedMask.begin(),
                          CapturedMask.end()));
   EXPECT_FALSE(std::equal(OtherMaskData.begin(), OtherMaskData.end(),
----------------
mshockwave wrote:

I think you can remove this negative test and use `EXPECT_FALSE(...m_Shuffle(m_Value(), m_Value(), m_SpecificMask(OtherMaskData)))` instead

https://github.com/llvm/llvm-project/pull/119592


More information about the llvm-commits mailing list