llvm.org GIT mirror llvm / 28f8634
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325848 91177308-0d34-0410-b5e6-96231b3b80d8 Aditya Nandakumar 2 years ago
2 changed file(s) with 7 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
9292 template struct Or {
9393 template
9494 bool match(MachineRegisterInfo &MRI, MatchSrc &&src) {
95 return true;
95 return false;
9696 }
9797 };
9898
367367 ASSERT_TRUE(match);
368368 ASSERT_EQ(Src0, Copies[0]);
369369 ASSERT_EQ(Src1, Copies[1]);
370
371 // Match a case where none of the predicates hold true.
372 match = mi_match(
373 MIBAdd->getOperand(0).getReg(), MRI,
374 m_any_of(m_SpecificType(LLT::scalar(16)), m_GSub(m_Reg(), m_Reg())));
375 ASSERT_FALSE(match);
370376 }
371377 } // namespace
372378