Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t |
| 2 | // RUN: grep "ret i32" %t | count 2 |
Daniel Dunbar | 16f2357 | 2008-07-25 01:11:38 +0000 | [diff] [blame] | 3 | // RUN: grep "ret i32 3" %t | count 2 |
| 4 | |
| 5 | // This generated incorrect code because of poor switch chaining. |
| 6 | int f1(int x) { |
| 7 | switch(x) { |
| 8 | default: |
| 9 | return 3; |
| 10 | case 10 ... 0xFFFFFFFF: |
| 11 | return 0; |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | // This just asserted because of the way case ranges were calculated. |
| 16 | int f2(int x) { |
| 17 | switch (x) { |
| 18 | default: |
| 19 | return 3; |
| 20 | case 10 ... -1: |
| 21 | return 0; |
| 22 | } |
| 23 | } |