diff options
| author | Jeffrey Byrnes <jeffrey.byrnes@amd.com> | 2025-06-11 18:07:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-11 18:07:00 -0700 |
| commit | 7034014d08249a1e159a668a71e96a0b78636a39 (patch) | |
| tree | 77f493f1699f6aed7c841136b4ffeb74255a1102 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | 7a3bcf9f7179e6904d405de36360714da07c31ba (diff) | |
[InstCombine] Combine or-disjoint (and->mul), (and->mul) to and->mul (#136013)
The canonical pattern for bitmasked mul is currently
```
%val = and %x, %bitMask // where %bitMask is some constant
%cmp = icmp eq %val, 0
%sel = select %cmp, 0, %C // where %C is some constant = C' * %bitMask
```
In certain cases, where we are combining multiple of these bitmasked
muls with common factors, we are able to optimize into and->mul (see
https://github.com/llvm/llvm-project/pull/135274 )
This optimization lends itself to further optimizations. This PR
addresses one of such optimizations.
In cases where we have
`or-disjoint ( mul(and (X, C1), D) , mul (and (X, C2), D))`
we can combine into
`mul( and (X, (C1 + C2)), D) `
provided C1 and C2 are disjoint.
Generalized proof: https://alive2.llvm.org/ce/z/MQYMui
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
