1; RUN: llc -march=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 i8*
9
10define i32 @f0() #0 personality i8* bitcast (i32 (...)* @f3 to i8*) {
11b0:
12  %v0 = alloca i32, align 4
13  %v1 = alloca i32, align 4
14  %v2 = alloca i8*
15  %v3 = alloca i32
16  %v4 = alloca i32, align 4
17  store i32 0, i32* %v0
18  store i32 1, i32* %v1, align 4
19  %v5 = call i8* @f1(i32 4) #2
20  %v6 = bitcast i8* %v5 to i32*
21  store i32 20, i32* %v6
22  invoke void @f2(i8* %v5, i8* bitcast (i8** @g0 to i8*), i8* null) #3
23          to label %b6 unwind label %b1
24
25b1:                                               ; preds = %b0
26  %v7 = landingpad { i8*, i32 }
27          catch i8* bitcast (i8** @g0 to i8*)
28  %v8 = extractvalue { i8*, i32 } %v7, 0
29  store i8* %v8, i8** %v2
30  %v9 = extractvalue { i8*, i32 } %v7, 1
31  store i32 %v9, i32* %v3
32  br label %b2
33
34b2:                                               ; preds = %b1
35  %v10 = load i32, i32* %v3
36  %v11 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @g0 to i8*)) #2
37  %v12 = icmp eq i32 %v10, %v11
38  br i1 %v12, label %b3, label %b5
39
40b3:                                               ; preds = %b2
41  %v13 = load i8*, i8** %v2
42  %v14 = call i8* @f4(i8* %v13) #2
43  %v15 = bitcast i8* %v14 to i32*
44  %v16 = load i32, i32* %v15, align 4
45  store i32 %v16, i32* %v4, align 4
46  store i32 2, i32* %v1, align 4
47  call void @f5() #2
48  br label %b4
49
50b4:                                               ; preds = %b3
51  %v17 = load i32, i32* %v1, align 4
52  ret i32 %v17
53
54b5:                                               ; preds = %b2
55  %v18 = load i8*, i8** %v2
56  %v19 = load i32, i32* %v3
57  %v20 = insertvalue { i8*, i32 } undef, i8* %v18, 0
58  %v21 = insertvalue { i8*, i32 } %v20, i32 %v19, 1
59  resume { i8*, i32 } %v21
60
61b6:                                               ; preds = %b0
62  unreachable
63}
64
65declare i8* @f1(i32)
66
67declare void @f2(i8*, i8*, i8*)
68
69declare i32 @f3(...)
70
71; Function Attrs: nounwind readnone
72declare i32 @llvm.eh.typeid.for(i8*) #1
73
74declare i8* @f4(i8*)
75
76declare void @f5()
77
78attributes #0 = { "frame-pointer"="all" }
79attributes #1 = { nounwind readnone }
80attributes #2 = { nounwind }
81attributes #3 = { noreturn }
82