summaryrefslogtreecommitdiff
path: root/test/Transforms/SimplifyCFG/unwindto.ll
blob: 4e91c8301502ebcdc82c1c7e2269d18883fd18f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep unwind_to | count 3

declare void @g(i32)

define i32 @f1() {
entry:
  br label %bb1
bb1: unwind_to %cleanup1
  call void @g(i32 0)
  br label %bb2
bb2: unwind_to %cleanup2
  call void @g(i32 1)
  br label %exit
exit:
  ret i32 0
cleanup1:
  ret i32 1
cleanup2:
  ret i32 2
}

define i32 @f2() {
entry: unwind_to %cleanup
  br label %bb1
bb1: unwind_to %cleanup
  br label %bb2
bb2: unwind_to %cleanup
  br label %bb3
bb3:
  br label %bb4
bb4: unwind_to %cleanup
  ret i32 0
cleanup:
  ret i32 1
}

define i32 @f3() {
entry: unwind_to %cleanup
  call void @g(i32 0)
  ret i32 0
cleanup:
  unwind
}

define i32 @f4() {
entry: unwind_to %cleanup
  call void @g(i32 0)
  br label %cleanup
cleanup:
  unwind
}

define i32 @f5() {
entry: unwind_to %cleanup
  call void @g(i32 0)
  br label %other
other:
  ret i32 0
cleanup:
  unwind
}