[GISel]: Fix base case for m_any_of PatternMatcher.
The base case for any_of was incorrectly returning true. Also add test
case which uses m_any_of(preds...) where none of the predicates are
true.
llvm-svn: 325848
diff --git a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
index b428101..aa18527 100644
--- a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
@@ -368,6 +368,12 @@
ASSERT_TRUE(match);
ASSERT_EQ(Src0, Copies[0]);
ASSERT_EQ(Src1, Copies[1]);
+
+ // Match a case where none of the predicates hold true.
+ match = mi_match(
+ MIBAdd->getOperand(0).getReg(), MRI,
+ m_any_of(m_SpecificType(LLT::scalar(16)), m_GSub(m_Reg(), m_Reg())));
+ ASSERT_FALSE(match);
}
} // namespace