207e0b3f707b91e11976c04ba692ca79e5e83b48
[oota-llvm.git] / test / CodeGen / X86 / switch-order-weight.ll
1 ; RUN: llc -mtriple=x86_64-apple-darwin11 < %s | FileCheck %s
2
3 ; Check that the cases which lead to unreachable are checked after "10"
4
5 define void @test1(i32 %x) nounwind uwtable ssp {
6 entry:
7   switch i32 %x, label %if.end7 [
8     i32 0, label %if.then
9     i32 10, label %if.then2
10     i32 20, label %if.then5
11   ]
12
13 ; CHECK-LABEL: test1:
14 ; CHECK-NOT: unr
15 ; CHECK: cmpl $10
16 ; CHECK: bar
17 ; CHECK: cmpl $20
18
19 if.then:
20   tail call void @unr(i32 23) noreturn nounwind
21   unreachable
22
23 if.then2:
24   tail call void @bar(i32 42) nounwind
25   br label %if.end7
26
27 if.then5:
28   tail call void @unr(i32 5) noreturn nounwind
29   unreachable
30
31 if.end7:
32   ret void
33 }
34
35 declare void @unr(i32) noreturn
36
37 declare void @bar(i32)