Index: include/llvm/IR/PatternMatch.h =================================================================== --- include/llvm/IR/PatternMatch.h +++ include/llvm/IR/PatternMatch.h @@ -705,6 +705,24 @@ } }; +template +struct CmpClassPred_match { + LHS_t L; + RHS_t R; + + CmpClassPred_match(const LHS_t &LHS, const RHS_t &RHS) + : L(LHS), R(RHS) {} + + template + bool match(OpTy *V) { + PredicateTy Pred; + CmpClass_match Inner(Pred, L, R); + if (Inner.match(V)) + return Pred == P; + return false; + } +}; + template inline CmpClass_match m_Cmp(CmpInst::Predicate &Pred, const LHS &L, const RHS &R) { @@ -717,6 +735,13 @@ return CmpClass_match(Pred, L, R); } +template +inline CmpClassPred_match +m_ICmpWithPred(const LHS &L, const RHS &R) { + return CmpClassPred_match(L, R); +} + template inline CmpClass_match m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) {