1; RUN: echo 'foo bb9' > %t
2; RUN: echo 'foo bb20' >> %t
3; RUN: opt -S -extract-blocks -extract-blocks-file=%t %s | FileCheck %s --check-prefix=CHECK-NO-ERASE
4; RUN: opt -S -extract-blocks -extract-blocks-file=%t -extract-blocks-erase-funcs %s | FileCheck %s --check-prefix=CHECK-ERASE
5; RUN: opt -S -passes=extract-blocks -extract-blocks-file=%t %s | FileCheck %s --check-prefix=CHECK-NO-ERASE
6; RUN: opt -S -passes=extract-blocks -extract-blocks-file=%t -extract-blocks-erase-funcs %s | FileCheck %s --check-prefix=CHECK-ERASE
7
8; CHECK-NO-ERASE: @foo(
9; CHECK-NO-ERASE: @foo.bb9(
10; CHECK-NO-ERASE: @foo.bb20(
11; CHECK-ERASE: declare i32 @foo(
12; CHECK-ERASE: @foo.bb9(
13; CHECK-ERASE: @foo.bb20(
14define i32 @foo(i32 %arg, i32 %arg1) {
15bb:
16  %tmp5 = icmp sgt i32 %arg, 0
17  %tmp8 = icmp sgt i32 %arg1, 0
18  %or.cond = and i1 %tmp5, %tmp8
19  br i1 %or.cond, label %bb9, label %bb14
20
21bb9:                                              ; preds = %bb
22  %tmp12 = shl i32 %arg1, 2
23  %tmp13 = add nsw i32 %tmp12, %arg
24  br label %bb30
25
26bb14:                                             ; preds = %bb
27  %0 = and i32 %arg1, %arg
28  %1 = icmp slt i32 %0, 0
29  br i1 %1, label %bb20, label %bb26
30
31bb20:                                             ; preds = %bb14
32  %tmp22 = mul nsw i32 %arg, 3
33  %tmp24 = sdiv i32 %arg1, 6
34  %tmp25 = add nsw i32 %tmp24, %tmp22
35  br label %bb30
36
37bb26:                                             ; preds = %bb14
38  %tmp29 = sub nsw i32 %arg, %arg1
39  br label %bb30
40
41bb30:                                             ; preds = %bb26, %bb20, %bb9
42  %tmp.0 = phi i32 [ %tmp13, %bb9 ], [ %tmp25, %bb20 ], [ %tmp29, %bb26 ]
43  ret i32 %tmp.0
44}
45
46