Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \ |
| 2 | ; RUN: not grep {icmp eq} |
| 3 | |
| 4 | ; Check that simplifycfg deletes a dead 'seteq' instruction when it |
| 5 | ; folds a conditional branch into a switch instruction. |
| 6 | |
| 7 | declare void %foo() |
| 8 | declare void %bar() |
| 9 | |
| 10 | void %testcfg(uint %V) { |
| 11 | %C = seteq uint %V, 18 |
| 12 | %D = seteq uint %V, 180 |
| 13 | %E = or bool %C, %D |
| 14 | br bool %E, label %L1, label %Sw |
| 15 | Sw: |
| 16 | switch uint %V, label %L1 [ |
| 17 | uint 15, label %L2 |
| 18 | uint 16, label %L2 |
| 19 | ] |
| 20 | L1: |
| 21 | call void %foo() |
| 22 | ret void |
| 23 | L2: |
| 24 | call void %bar() |
| 25 | ret void |
| 26 | } |
| 27 | |