summaryrefslogtreecommitdiff
path: root/offload
diff options
context:
space:
mode:
authorPedro Lobo <pedro.lobo@tecnico.ulisboa.pt>2025-11-22 15:44:06 +0000
committerGitHub <noreply@github.com>2025-11-22 15:44:06 +0000
commite8af134bb7f891caa49178c8a04a8ca944c611df (patch)
treee67e6dd18345210bef83888631439db6a639426c /offload
parentcc4dd015ad4a1b33d43fbac00d62f6b309a96ff4 (diff)
[InstCombine] Generalize trunc-shift-icmp fold from (1 << Y) to (Pow2 << Y) (#169163)
Extends the `icmp(trunc(shl))` fold to handle any power of 2 constant as the shift base, not just 1. This generalizes the following patterns by adjusting the comparison offsets by `log2(Pow2)`. ```llvm (trunc (1 << Y) to iN) == 0 --> Y u>= N (trunc (1 << Y) to iN) != 0 --> Y u< N (trunc (1 << Y) to iN) == 2**C --> Y == C (trunc (1 << Y) to iN) != 2**C --> Y != C ; to (trunc (Pow2 << Y) to iN) == 0 --> Y u>= N - log2(Pow2) (trunc (Pow2 << Y) to iN) != 0 --> Y u< N - log2(Pow2) (trunc (Pow2 << Y) to iN) == 2**C --> Y == C - log2(Pow2) (trunc (Pow2 << Y) to iN) != 2**C --> Y != C - log2(Pow2) ``` Proof: https://alive2.llvm.org/ce/z/2zwTkp
Diffstat (limited to 'offload')
0 files changed, 0 insertions, 0 deletions