@@ -1239,7 +1239,7 @@ inline SpecificBinaryOp_match<LHS, RHS> m_BinOp(unsigned Opcode, const LHS &L,
12391239 return SpecificBinaryOp_match<LHS, RHS>(Opcode, L, R);
12401240}
12411241
1242- template <typename LHS, typename RHS>
1242+ template <typename LHS, typename RHS, bool Commutable = false >
12431243struct DisjointOr_match {
12441244 LHS L;
12451245 RHS R;
@@ -1251,7 +1251,9 @@ struct DisjointOr_match {
12511251 assert (PDI->getOpcode () == Instruction::Or && " Only or can be disjoint" );
12521252 if (!PDI->isDisjoint ())
12531253 return false ;
1254- return L.match (PDI->getOperand (0 )) && R.match (PDI->getOperand (1 ));
1254+ return (L.match (PDI->getOperand (0 )) && R.match (PDI->getOperand (1 ))) ||
1255+ (Commutable && L.match (PDI->getOperand (1 )) &&
1256+ R.match (PDI->getOperand (0 )));
12551257 }
12561258 return false ;
12571259 }
@@ -1262,6 +1264,12 @@ inline DisjointOr_match<LHS, RHS> m_DisjointOr(const LHS &L, const RHS &R) {
12621264 return DisjointOr_match<LHS, RHS>(L, R);
12631265}
12641266
1267+ template <typename LHS, typename RHS>
1268+ inline DisjointOr_match<LHS, RHS, true > m_c_DisjointOr (const LHS &L,
1269+ const RHS &R) {
1270+ return DisjointOr_match<LHS, RHS, true >(L, R);
1271+ }
1272+
12651273// ===----------------------------------------------------------------------===//
12661274// Class that matches a group of binary opcodes.
12671275//
0 commit comments