Index: include/llvm/IR/PatternMatch.h =================================================================== --- include/llvm/IR/PatternMatch.h +++ include/llvm/IR/PatternMatch.h @@ -1193,6 +1193,27 @@ } //===----------------------------------------------------------------------===// +// Matcher for StoreInst classes +// + +template struct StoreClass_match { + Op_t Op; + + StoreClass_match(const Op_t &OpMatch) : Op(OpMatch) {} + + template bool match(OpTy *V) { + if (auto *LI = dyn_cast(V)) + return Op.match(LI->getPointerOperand()); + return false; + } +}; + +/// Matches StoreInst. +template inline StoreClass_match m_Store(const OpTy &Op) { + return StoreClass_match(Op); +} + +//===----------------------------------------------------------------------===// // Matchers for unary operators //