blob: 96a8ae5f6ff0ab9df27aefb6ee840f52e62dea19 [file] [log] [blame]
Krzysztof Parzyszek046090d2018-03-12 14:01:28 +00001; RUN: llc -march=hexagon < %s | FileCheck %s
2; CHECK: .cfi_offset r31, -4
3; CHECK: .cfi_offset r30, -8
4; CHECK: .cfi_offset r17, -12
5; CHECK: .cfi_offset r16, -16
6
7@g0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
8@g1 = external constant i8*
9@g2 = private unnamed_addr constant [15 x i8] c"blah blah blah\00", align 1
10@g3 = external constant i8*
11@g4 = private unnamed_addr constant [2 x i8] c"{\00"
12@g5 = private unnamed_addr constant [2 x i8] c"}\00"
13@g6 = private unnamed_addr constant [27 x i8] c"FAIL:Unexpected exception.\00"
14
15; Function Attrs: nounwind
16declare i32 @f0(i8* nocapture readonly, ...) #0
17
18; Function Attrs: nounwind
19define void @f1(i32 %a0) #0 {
20b0:
21 %v0 = tail call i32 (i8*, ...) @f0(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @g0, i32 0, i32 0), i32 %a0)
22 ret void
23}
24
25define i32 @f2(i32 %a0, i8** nocapture readnone %a1) personality i8* bitcast (i32 (...)* @f5 to i8*) {
26b0:
27 %v0 = tail call i32 (i8*, ...) @f0(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @g0, i32 0, i32 0), i32 %a0) #0
28 %v1 = tail call i32 @f8(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @g4, i32 0, i32 0)) #0
29 %v2 = tail call i8* @f3(i32 4) #0
30 %v3 = bitcast i8* %v2 to i8**
31 store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @g2, i32 0, i32 0), i8** %v3, align 4, !tbaa !0
32 invoke void @f4(i8* %v2, i8* bitcast (i8** @g1 to i8*), i8* null) #2
33 to label %b9 unwind label %b1
34
35b1: ; preds = %b0
36 %v4 = landingpad { i8*, i32 }
37 catch i8* bitcast (i8** @g1 to i8*)
38 catch i8* null
39 %v5 = extractvalue { i8*, i32 } %v4, 0
40 %v6 = extractvalue { i8*, i32 } %v4, 1
41 %v7 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @g1 to i8*)) #0
42 %v8 = icmp eq i32 %v6, %v7
43 %v9 = tail call i8* @f6(i8* %v5) #0
44 br i1 %v8, label %b2, label %b3
45
46b2: ; preds = %b1
47 tail call void @f7() #0
48 br label %b4
49
50b3: ; preds = %b1
51 %v10 = tail call i32 @f8(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @g6, i32 0, i32 0))
52 tail call void @f7()
53 br label %b4
54
55b4: ; preds = %b3, %b2
56 %v11 = tail call i32 @f8(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @g5, i32 0, i32 0)) #0
57 %v12 = tail call i32 @f8(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @g4, i32 0, i32 0)) #0
58 %v13 = tail call i8* @f3(i32 4) #0
59 %v14 = bitcast i8* %v13 to i32*
60 store i32 777, i32* %v14, align 4, !tbaa !4
61 invoke void @f4(i8* %v13, i8* bitcast (i8** @g3 to i8*), i8* null) #2
62 to label %b9 unwind label %b5
63
64b5: ; preds = %b4
65 %v15 = landingpad { i8*, i32 }
66 catch i8* bitcast (i8** @g3 to i8*)
67 catch i8* null
68 %v16 = extractvalue { i8*, i32 } %v15, 0
69 %v17 = extractvalue { i8*, i32 } %v15, 1
70 %v18 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @g3 to i8*)) #0
71 %v19 = icmp eq i32 %v17, %v18
72 %v20 = tail call i8* @f6(i8* %v16) #0
73 br i1 %v19, label %b6, label %b7
74
75b6: ; preds = %b5
76 tail call void @f7() #0
77 br label %b8
78
79b7: ; preds = %b5
80 %v21 = tail call i32 @f8(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @g6, i32 0, i32 0))
81 tail call void @f7()
82 br label %b8
83
84b8: ; preds = %b7, %b6
85 %v22 = tail call i32 @f8(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @g5, i32 0, i32 0)) #0
86 ret i32 0
87
88b9: ; preds = %b4, %b0
89 unreachable
90}
91
92declare i8* @f3(i32)
93
94declare void @f4(i8*, i8*, i8*)
95
96declare i32 @f5(...)
97
98; Function Attrs: nounwind readnone
99declare i32 @llvm.eh.typeid.for(i8*) #1
100
101declare i8* @f6(i8*)
102
103declare void @f7()
104
105; Function Attrs: nounwind
106declare i32 @f8(i8* nocapture readonly) #0
107
108attributes #0 = { nounwind }
109attributes #1 = { nounwind readnone }
110attributes #2 = { noreturn }
111
112!0 = !{!1, !1, i64 0}
113!1 = !{!"any pointer", !2, i64 0}
114!2 = !{!"omnipotent char", !3, i64 0}
115!3 = !{!"Simple C/C++ TBAA"}
116!4 = !{!5, !5, i64 0}
117!5 = !{!"int", !2, i64 0}