1; RUN: llvm-extract -S -bb foo:bb4 %s | FileCheck %s
2
3; CHECK: declare void @bar()
4define void @bar() {
5bb:
6  ret void
7}
8
9; CHECK-NOT: @unused()
10define void @unused() {
11bb:
12  ret void
13}
14
15; CHECK: @foo.bb4
16; CHECK: call void @bar()
17; CHECK: %tmp5
18define i32 @foo(i32 %arg) {
19bb:
20  %tmp = alloca i32, align 4
21  %tmp1 = alloca i32, align 4
22  store i32 %arg, i32* %tmp1, align 4
23  %tmp2 = load i32, i32* %tmp1, align 4
24  %tmp3 = icmp sgt i32 %tmp2, 0
25  br i1 %tmp3, label %bb4, label %bb7
26
27bb4:                                              ; preds = %bb
28  call void @bar()
29  %tmp5 = load i32, i32* %tmp1, align 4
30  %tmp6 = add nsw i32 %tmp5, 1
31  store i32 %tmp6, i32* %tmp1, align 4
32  store i32 %tmp6, i32* %tmp, align 4
33  br label %bb8
34
35bb7:                                              ; preds = %bb
36  store i32 0, i32* %tmp, align 4
37  br label %bb8
38
39bb8:                                              ; preds = %bb7, %bb4
40  %tmp9 = load i32, i32* %tmp, align 4
41  ret i32 %tmp9
42}
43
44