[llvm] [InstCombine] Optimise the expression `(C & A) | (select (C ^ true), B, false) => (C & A) | (!C & B)` with `FoldOrOfAndsWithSelectToLogical` (PR #178438)

Rajveer Singh Bharadwaj via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 2 05:40:48 PST 2026


================
@@ -4136,6 +4202,20 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
     return BinaryOperator::CreateMul(X, IncrementY);
   }
 
+  // (C & A) | (select (C ^ true), B, false) => (C & A) | (!C & B)
----------------
Rajveer100 wrote:

Instead of a complete reuse, isn't it much simpler this way?

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


More information about the llvm-commits mailing list