xref: /llvm-project/llvm/test/CodeGen/Hexagon/ehabi.ll (revision 2208c97c1bec2512d4e47b6223db6d95a7037956)
1; RUN: llc -mtriple=hexagon -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
2
3; CHECK: GCC_except_table0:
4; CHECK: Call site Encoding = uleb128
5
6target triple = "hexagon"
7
8@g0 = external constant ptr
9
10define i32 @f0() #0 personality ptr @f3 {
11b0:
12  %v0 = alloca i32, align 4
13  %v1 = alloca i32, align 4
14  %v2 = alloca ptr
15  %v3 = alloca i32
16  %v4 = alloca i32, align 4
17  store i32 0, ptr %v0
18  store i32 1, ptr %v1, align 4
19  %v5 = call ptr @f1(i32 4) #2
20  store i32 20, ptr %v5
21  invoke void @f2(ptr %v5, ptr @g0, ptr null) #3
22          to label %b6 unwind label %b1
23
24b1:                                               ; preds = %b0
25  %v7 = landingpad { ptr, i32 }
26          catch ptr @g0
27  %v8 = extractvalue { ptr, i32 } %v7, 0
28  store ptr %v8, ptr %v2
29  %v9 = extractvalue { ptr, i32 } %v7, 1
30  store i32 %v9, ptr %v3
31  br label %b2
32
33b2:                                               ; preds = %b1
34  %v10 = load i32, ptr %v3
35  %v11 = call i32 @llvm.eh.typeid.for(ptr @g0) #2
36  %v12 = icmp eq i32 %v10, %v11
37  br i1 %v12, label %b3, label %b5
38
39b3:                                               ; preds = %b2
40  %v13 = load ptr, ptr %v2
41  %v14 = call ptr @f4(ptr %v13) #2
42  %v16 = load i32, ptr %v14, align 4
43  store i32 %v16, ptr %v4, align 4
44  store i32 2, ptr %v1, align 4
45  call void @f5() #2
46  br label %b4
47
48b4:                                               ; preds = %b3
49  %v17 = load i32, ptr %v1, align 4
50  ret i32 %v17
51
52b5:                                               ; preds = %b2
53  %v18 = load ptr, ptr %v2
54  %v19 = load i32, ptr %v3
55  %v20 = insertvalue { ptr, i32 } undef, ptr %v18, 0
56  %v21 = insertvalue { ptr, i32 } %v20, i32 %v19, 1
57  resume { ptr, i32 } %v21
58
59b6:                                               ; preds = %b0
60  unreachable
61}
62
63declare ptr @f1(i32)
64
65declare void @f2(ptr, ptr, ptr)
66
67declare i32 @f3(...)
68
69; Function Attrs: nounwind readnone
70declare i32 @llvm.eh.typeid.for(ptr) #1
71
72declare ptr @f4(ptr)
73
74declare void @f5()
75
76attributes #0 = { "frame-pointer"="all" }
77attributes #1 = { nounwind readnone }
78attributes #2 = { nounwind }
79attributes #3 = { noreturn }
80