[llvm] [InstCombine] Reassociate commutative binops over select/phi/minmax (PR #187493)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 09:35:04 PDT 2026
================
@@ -607,6 +622,20 @@ bool InstCombinerImpl::SimplifyAssociativeOrCommutative(BinaryOperator &I) {
Value *B = Op1->getOperand(0);
Value *C = Op1->getOperand(1);
+ // Form "B op V" when "C op A" is a symmetric pair.
+ if (Op1->hasOneUse()) {
----------------
dtcxzyw wrote:
I guess we can extract a lambda helper to reduce code duplication.
https://github.com/llvm/llvm-project/pull/187493
More information about the llvm-commits
mailing list