[all-commits] [llvm/llvm-project] 2c6a3d: [SimplifyCFG] Improve reduceSwitchRange to avoid u...
Drew Kersnar via All-commits
all-commits at lists.llvm.org
Wed Jul 8 12:29:55 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2c6a3d29636a54246738347f801c77cb15ac8241
https://github.com/llvm/llvm-project/commit/2c6a3d29636a54246738347f801c77cb15ac8241
Author: Drew Kersnar <dkersnar at nvidia.com>
Date: 2026-07-08 (Wed, 08 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
M llvm/test/Transforms/SimplifyCFG/rangereduce.ll
Log Message:
-----------
[SimplifyCFG] Improve reduceSwitchRange to avoid unnecessary subtractions (#198374)
Dense switch cases can sometimes be achieved with only a shift, avoiding
a subtract. Change reduceSwitchRange to check for such cases before
falling back to using a subtract.
The changes to test9 demonstrates that for the purpose of lookup-table
lowering (triggered by the switch-to-lookup flag), the switch range
still ends up normalized to start at 0, the subtraction just happens
after the fshl.
test10 demonstrates where this change is useful, resulting in a dense
switch case with one less subtract.
test11 demonstrates cases where the subtract is still needed in order to
form a dense switch case.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list