author | Hans Wennborg <hans@hanshq.net> | |
Wed, 15 Jan 2014 05:00:27 +0000 (05:00 +0000) | ||
committer | Hans Wennborg <hans@hanshq.net> | |
Wed, 15 Jan 2014 05:00:27 +0000 (05:00 +0000) | ||
commit | 89fa06ba0f54cc90dbdce4f6a91d09f30f033e0a | |
tree | fd021a5cd5388589f0382cc26741f45cb525a286 | tree | snapshot (tar.xz tar.gz zip) |
parent | 27a41c154721b38f0192d9bd2e1d90e43f5083e4 | commit | diff |
Switch-to-lookup tables: set threshold to 3 cases
There has been an old FIXME to find the right cut-off for when it's worth
analyzing and potentially transforming a switch to a lookup table.
The switches always have two or more cases. I could not measure any speed-up
by transforming a switch with two cases. A switch with three cases gets a nice
speed-up, and I couldn't measure any compile-time regression, so I think this
is the right threshold.
In a Clang self-host, this causes 480 new switches to be transformed,
and reduces the final binary size with 8 KB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199294 91177308-0d34-0410-b5e6-96231b3b80d8
There has been an old FIXME to find the right cut-off for when it's worth
analyzing and potentially transforming a switch to a lookup table.
The switches always have two or more cases. I could not measure any speed-up
by transforming a switch with two cases. A switch with three cases gets a nice
speed-up, and I couldn't measure any compile-time regression, so I think this
is the right threshold.
In a Clang self-host, this causes 480 new switches to be transformed,
and reduces the final binary size with 8 KB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199294 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp | diff | blob | history | |
test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll | diff | blob | history |