[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
Tue Dec 19 03:42:20 PST 2023


================
@@ -1505,6 +1505,9 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
     return Sub;
   }
 
+  if (Value *V = SimplifyPhiCommutativeBinaryOp(I, LHS, RHS))
----------------
nikic wrote:

Call this from foldBinopWithPhiOperands() instead of repeating it everywhere?

https://github.com/llvm/llvm-project/pull/75765


More information about the llvm-commits mailing list