[llvm] [InstSimplify] Use multi-op replacement when simplify `select` (PR #121708)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 5 14:39:35 PST 2025
================
@@ -4712,23 +4733,29 @@ static Value *simplifySelectWithICmpCond(Value *CondVal, Value *TrueVal,
if (match(CmpLHS, m_Or(m_Value(X), m_Value(Y))) &&
match(CmpRHS, m_Zero())) {
// (X | Y) == 0 implies X == 0 and Y == 0.
- if (Value *V = simplifySelectWithEquivalence(X, CmpRHS, TrueVal, FalseVal,
- Q, MaxRecurse))
+ if (Value *V = simplifySelectWithEquivalence(
+ {{X, CmpRHS}, {Y, CmpRHS}}, TrueVal, FalseVal, Q, MaxRecurse))
+ return V;
+ if (Value *V = simplifySelectWithEquivalence({{X, CmpRHS}}, TrueVal,
+ FalseVal, Q, MaxRecurse))
return V;
- if (Value *V = simplifySelectWithEquivalence(Y, CmpRHS, TrueVal, FalseVal,
- Q, MaxRecurse))
+ if (Value *V = simplifySelectWithEquivalence({{Y, CmpRHS}}, TrueVal,
+ FalseVal, Q, MaxRecurse))
----------------
nikic wrote:
Why do we need to do the replacement of both variables, and then also try to replace only a single variable?
https://github.com/llvm/llvm-project/pull/121708
More information about the llvm-commits
mailing list