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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 11:09:59 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.
----------------
preames wrote:

If I'm reading this right, it should always be legal to treat the disjoint or as and add, and the inner opcode check is to ensure it can distribute?  i.e. it's basically a profitability check?  If so, can you adjust the comment to be a bit more clear about that?

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


More information about the llvm-commits mailing list