1; RUN: opt -passes="default<O1>" %s -S | FileCheck %s
2; REQUIRES: asserts
3
4declare void @bar()
5declare void @baz(i32*)
6
7; CHECK-LABEL: @foo1()
8define void @foo1() {
9entry:
10  %tag = alloca i32, align 4
11  call void @baz(i32* %tag)
12  %tmp = load i32, i32* %tag, align 4
13  switch i32 %tmp, label %sw.bb799 [
14    i32 10, label %sw.bb239
15  ]
16
17sw.bb239:
18  call void @foo2()
19  br label %cleanup871
20
21sw.bb799:
22  call void @foo3(i32 undef)
23  br label %cleanup871
24
25cleanup871:
26  call void @bar()
27  unreachable
28}
29
30define void @foo2() {
31  call void @foo4()
32  unreachable
33}
34
35define void @foo3(i32 %ptr) {
36  call void @foo1()
37  unreachable
38}
39
40define void @foo4() {
41entry:
42  %tag = alloca i32, align 4
43  call void @baz(i32* %tag)
44  %tmp = load i32, i32* %tag, align 4
45  switch i32 %tmp, label %sw.bb442 [
46    i32 16, label %sw.bb352
47  ]
48
49sw.bb352:
50  call void @foo3(i32 undef)
51  unreachable
52
53sw.bb442:
54  call void @foo2()
55  unreachable
56}
57
58