[llvm] [InstCombine] Extend bitmask mul combine to handle independent operands (PR #142503)
Jeffrey Byrnes via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 12:29:57 PDT 2025
jrbyrnes wrote:
> We need one-use checks to ensure we're not emitting more instructions if some of the old ones have extra uses
Is this a hard requirement for InstCombines in general? I wonder if we can special case this, or only add it as needed?
I ask because adding the oneUse heuristic breaks my case. Thus, I would need to add a refined and expensive heuristic.
The main beneficiary / code I am designing against is a new implementation for calculating addresses. Each and->cmp->sel (or and->mul) contributes some partial information to the final address (think indexing into a multi dimensional vector). So, the and->cmp and and->cmp->sel (and and->mul) pieces are reused by design -- with the multiple users each being able to do their own combines.
Not to mention, this whole effort has been a workaround of the `computeKnownBits` depth limit, so even if we didn't have "other users with their own combines" and this only served to introduce code, it would still benefit the generated assembly since it would reduce the depth limit to allow xor -> or-disjoint and folding of constants into addresses.
https://github.com/llvm/llvm-project/pull/142503
More information about the llvm-commits
mailing list