| commit | 9e74dd97b8092174214ce0885dca5b56c5b9eba7 | [log] [tgz] |
|---|---|---|
| author | Hans Wennborg <hans@hanshq.net> | Wed Oct 31 13:42:45 2012 +0000 |
| committer | Hans Wennborg <hans@hanshq.net> | Wed Oct 31 13:42:45 2012 +0000 |
| tree | e5787617b357676ae259c65968f7f7eadec794e4 | |
| parent | 86bdab74688b6e3bfac37c62b7ef0644e8616b11 [diff] |
Do simple constant propagation in lookup table formation for switches
By propagating the value for the switch condition, LLVM can now build
lookup tables for code such as:
switch (x) {
case 1: return 5;
case 2: return 42;
case 3: case 4: case 5:
return x - 123;
default:
return 123;
}
Given that x is known for each case, "x - 123" becomes a constant for
cases 3, 4, and 5.
llvm-svn: 167115