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

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 10:03:56 PDT 2025


jrbyrnes wrote:

Thanks for the clarification.

The latest introduces `reassociateDisjointOr` . This method takes the operands of an or-disjoint and checks all permutations of child trees when one or both of the operands are themselves or-disjoints.

These permutations are checked for `foldDisjointOr` patterns -- this currently just checks `foldBitmaskMul` but can easily be extended.

I've tried to follow the implementation and caller pattern for `reassociateBooleanAndOr` but I found the structure to be quite confusing. In particular, I found it strange that the caller was responsible for deconstructing a tree, and the method was responsible for permuting it -- this created some strange contracts between caller/method, especially in the case where both operands were or-disjoints.

Thus, `reassociateDisjointOr` is responsible for both deconstructing the tree and permuting it, and the caller is just responsible for providing the operands of or-disjoint.

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


More information about the llvm-commits mailing list