[llvm] [InstCombine] Extend bitmask mul combine to handle independent operands (PR #142503)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 11:31:14 PDT 2025


jrbyrnes wrote:

Okay -- the latest version reassociates chains with independent operands into a more combineable pattern (rather than doing the combine itself).

We should only be doing this reassociation if we can find a bitmask mul operand on both sides, otherwise we may end up infinitely reassociating. Since we require the DecomposedBitMaskMul analysis, I've decided to do the reassocation in InstCombineAndOrXor where the analysis already exists.

The implementation does seem a little simpler, but we now rely on future iterations of InstCombine to perform the optimization. Moreover, we still need to do the analysis to check for the conditions of reassocation. Thus, it is somewhat unclear if this change is a net positive.

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


More information about the llvm-commits mailing list