[VPlan] Remove redundant x && (y && x) -> x && y combine (#213219)
It can be subsumed by making the combine above commutative. In theory this isn't NFC as it changes the order, in practice it doesn't make a difference.
This commit is contained in:
parent
136347be7a
commit
8db13de265
2 changed files with 9 additions and 10 deletions
|
|
@ -199,6 +199,11 @@ inline bind_const_int m_ConstantInt(uint64_t &C) { return C; }
|
|||
/// Match a VPValue, capturing it if we match.
|
||||
inline match_bind<VPValue> m_VPValue(VPValue *&V) { return V; }
|
||||
|
||||
/// Match against the nested pattern, and capture the value if we match.
|
||||
template <typename Op_t> inline auto m_VPValue(VPValue *&V, const Op_t &Op) {
|
||||
return m_CombineAnd(Op, m_VPValue(V));
|
||||
}
|
||||
|
||||
/// Match a VPIRValue.
|
||||
inline match_bind<VPIRValue> m_VPIRValue(VPIRValue *&V) { return V; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1188,16 +1188,10 @@ static bool simplifyLogicalRecipe(VPSingleDefRecipe *Def, VPBuilder &Builder,
|
|||
}
|
||||
|
||||
// x && (x && y) -> x && y
|
||||
if (match(Def, m_LogicalAnd(m_VPValue(X),
|
||||
m_LogicalAnd(m_Deferred(X), m_VPValue())))) {
|
||||
Def->replaceAllUsesWith(Def->getOperand(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
// x && (y && x) -> x && y
|
||||
if (match(Def, m_LogicalAnd(m_VPValue(X),
|
||||
m_LogicalAnd(m_VPValue(Y), m_Deferred(X))))) {
|
||||
Def->replaceAllUsesWith(Builder.createLogicalAnd(X, Y));
|
||||
if (match(Def, m_c_LogicalAnd(m_VPValue(X),
|
||||
m_VPValue(Z, m_c_LogicalAnd(m_Deferred(X),
|
||||
m_VPValue()))))) {
|
||||
Def->replaceAllUsesWith(Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue