[llvm] [InstCombine] Teach tryFactorization to treat a disjoint Or like an Add. (PR #75691)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 11:23:17 PST 2024


================
@@ -646,6 +646,11 @@ static Value *tryFactorization(BinaryOperator &I, const SimplifyQuery &SQ,
   Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
   Instruction::BinaryOps TopLevelOpcode = I.getOpcode();
 
+  // Treat a disjoint Or like an Add if the inner opcode is a Mul.
----------------
topperc wrote:

If we treat it like an Add unconditionally, then we miss distribution opportunities on the Or because Add doesn't distribute over the same operations that Or does.

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


More information about the llvm-commits mailing list