summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h2
-rw-r--r--llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h b/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
index 8adeb4969e6..e3302217696 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
@@ -93,7 +93,7 @@ struct And<Pred, Preds...> : And<Preds...> {
template <typename... Preds> struct Or {
template <typename MatchSrc>
bool match(MachineRegisterInfo &MRI, MatchSrc &&src) {
- return true;
+ return false;
}
};
diff --git a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
index b4281013350..aa185278f59 100644
--- a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
@@ -368,6 +368,12 @@ TEST(PatternMatchInstr, MatchCombinators) {
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
OpenPOWER on IntegriCloud