[llvm] [InstCombine] fold (Binop phi(a, b) phi(b, a)) -> (Binop a, b) while Binop is commutative. (PR #75765)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 02:11:29 PST 2023
================
@@ -1096,6 +1096,63 @@ Value *InstCombinerImpl::foldUsingDistributiveLaws(BinaryOperator &I) {
return SimplifySelectsFeedingBinaryOp(I, LHS, RHS);
}
+bool InstCombinerImpl::matchSymmetricPhiNodesPair(PHINode *LHS, PHINode *RHS) {
+
+ if (LHS->getParent() != RHS->getParent())
+ return false;
+
+ if (LHS->getNumIncomingValues() != RHS->getNumIncomingValues())
----------------
nikic wrote:
No need to check this, it's implied by same parent.
https://github.com/llvm/llvm-project/pull/75765
More information about the llvm-commits
mailing list