[llvm] InstCombine: fold(select C, (X | A), X) | B into X | select C, (A | B), B. (#154246) (PR #154267)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 07:11:33 PDT 2025


================
@@ -2695,6 +2695,40 @@ Instruction *InstCombinerImpl::visitAnd(BinaryOperator &I) {
   if (Instruction *FoldedLogic = foldBinOpIntoSelectOrPhi(I))
     return FoldedLogic;
 
+  // Factor a common operand across select feeding an 'or':
----------------
dtcxzyw wrote:

Any reason for duplicating the code in visitAnd?


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


More information about the llvm-commits mailing list