[llvm] [InstCombine] fold commutative binop with const into select (PR #183692)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 22:48:07 PST 2026


================
@@ -2324,6 +2324,15 @@ Instruction *InstCombinerImpl::foldBinOpIntoSelectOrPhi(BinaryOperator &I) {
     if (Instruction *NewPhi = foldOpIntoPhi(I, PN))
       return NewPhi;
   }
+
+  if (I.isCommutative()) {
----------------
imkiva wrote:

Oh thanks for pointing this out. I removed the commutative check.

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


More information about the llvm-commits mailing list