diff options
| author | Hans Wennborg <hans@hanshq.net> | 2012-09-06 09:43:28 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2012-09-06 09:43:28 +0000 |
| commit | 8a62fc52942f8c5e551c53345780aa9996051da5 (patch) | |
| tree | a39a3d2734fc992069b286894e0963bf4a2a3dec /llvm/lib/CodeGen/SelectionDAG/SDNodeOrdering.h | |
| parent | 447ff7028052393aaa53ed3a5dbbe6c2590d9ffc (diff) | |
| download | bcm5719-llvm-8a62fc52942f8c5e551c53345780aa9996051da5.tar.gz bcm5719-llvm-8a62fc52942f8c5e551c53345780aa9996051da5.zip | |
Build lookup tables for switches (PR884)
This adds a transformation to SimplifyCFG that attemps to turn switch
instructions into loads from lookup tables. It works on switches that
are only used to initialize one or more phi nodes in a common successor
basic block, for example:
int f(int x) {
switch (x) {
case 0: return 5;
case 1: return 4;
case 2: return -2;
case 5: return 7;
case 6: return 9;
default: return 42;
}
This speeds up the code by removing the hard-to-predict jump, and
reduces code size by removing the code for the jump targets.
llvm-svn: 163302
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SDNodeOrdering.h')
0 files changed, 0 insertions, 0 deletions

