diff options
author | Hans Wennborg <hans@hanshq.net> | 2014-01-12 00:44:41 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2014-01-12 00:44:41 +0000 |
commit | ac114a3ce7deffc3d82a5ba72c26481a6a6ae219 (patch) | |
tree | aa98c3240fe181e06e6e66ee7e82627a21048824 /llvm/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp | |
parent | a66b314c349ab952e1415323cabc500b635ae442 (diff) | |
download | llvm-ac114a3ce7deffc3d82a5ba72c26481a6a6ae219.zip llvm-ac114a3ce7deffc3d82a5ba72c26481a6a6ae219.tar.gz llvm-ac114a3ce7deffc3d82a5ba72c26481a6a6ae219.tar.bz2 |
Switch-to-lookup tables: Don't require a result for the default
case when the lookup table doesn't have any holes.
This means we can build a lookup table for switches like this:
switch (x) {
case 0: return 1;
case 1: return 2;
case 2: return 3;
case 3: return 4;
default: exit(1);
}
The default case doesn't yield a constant result here, but that doesn't matter,
since a default result is only necessary for filling holes in the lookup table,
and this table doesn't have any holes.
This makes us transform 505 more switches in a clang bootstrap, and shaves 164 KB
off the resulting clang binary.
llvm-svn: 199025
Diffstat (limited to 'llvm/lib/Target/Sparc/Disassembler/SparcDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions