1; RUN: llc < %s -march=sparc | FileCheck %s
2
3
4%struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
5%struct.__type_info_pseudo = type { i8*, i8* }
6
7@_ZTIi = external constant %struct.__fundamental_type_info_pseudo
8@_ZTIf = external constant %struct.__fundamental_type_info_pseudo
9@.cst = linker_private unnamed_addr constant [12 x i8] c"catched int\00", align 64
10@.cst1 = linker_private unnamed_addr constant [14 x i8] c"catched float\00", align 64
11
12; CHECK-LABEL: main:
13; CHECK:       .cfi_startproc
14; CHECK:       .cfi_def_cfa_register 30
15; CHECK:       .cfi_window_save
16; CHECK:       .cfi_register 15, 31
17
18; CHECK:        call __cxa_throw
19; CHECK:        call __cxa_throw
20
21; CHECK:        call __cxa_begin_catch
22; CHECK:        call __cxa_end_catch
23
24; CHECK:        call __cxa_begin_catch
25; CHECK:        call __cxa_end_catch
26
27; CHECK:        .cfi_endproc
28
29define i32 @main(i32 %argc, i8** nocapture readnone %argv) unnamed_addr #0 {
30entry:
31  %0 = icmp eq i32 %argc, 2
32  %1 = tail call i8* @__cxa_allocate_exception(i32 4) #1
33  br i1 %0, label %"3", label %"4"
34
35"3":                                              ; preds = %entry
36  %2 = bitcast i8* %1 to i32*
37  store i32 0, i32* %2, align 4
38  invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*), void (i8*)* null) #2
39          to label %3 unwind label %"8"
40
41; <label>:3                                       ; preds = %"3"
42  unreachable
43
44"4":                                              ; preds = %entry
45  %4 = bitcast i8* %1 to float*
46  store float 1.000000e+00, float* %4, align 4
47
48
49  invoke void @__cxa_throw(i8* %1, i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*), void (i8*)* null) #2
50          to label %5 unwind label %"8"
51
52; <label>:5                                       ; preds = %"4"
53  unreachable
54
55"5":                                              ; preds = %"13", %"11"
56  %6 = phi i32 [ 2, %"13" ], [ 0, %"11" ]
57  ret i32 %6
58
59"8":                                              ; preds = %"4", %"3"
60  %exc = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0
61          catch %struct.__fundamental_type_info_pseudo* @_ZTIi
62          catch %struct.__fundamental_type_info_pseudo* @_ZTIf
63  %exc_ptr12 = extractvalue { i8*, i32 } %exc, 0
64  %filter13 = extractvalue { i8*, i32 } %exc, 1
65  %typeid = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*))
66  %7 = icmp eq i32 %filter13, %typeid
67  br i1 %7, label %"11", label %8
68
69; <label>:8                                       ; preds = %"8"
70  %typeid8 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIf to i8*))
71  %9 = icmp eq i32 %filter13, %typeid8
72  br i1 %9, label %"13", label %"9"
73
74"9":                                              ; preds = %8
75  resume { i8*, i32 } %exc
76
77"11":                                             ; preds = %"8"
78  %10 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
79  %11 = tail call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.cst, i32 0, i32 0))
80  tail call void @__cxa_end_catch() #1
81  br label %"5"
82
83"13":                                             ; preds = %8
84  %12 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr12) #1
85  %13 = tail call i32 @puts(i8* getelementptr inbounds ([14 x i8]* @.cst1, i32 0, i32 0))
86  tail call void @__cxa_end_catch() #1
87  br label %"5"
88}
89
90; Function Attrs: nounwind
91declare i8* @__cxa_allocate_exception(i32) #1
92
93; Function Attrs: noreturn
94declare void @__cxa_throw(i8*, i8*, void (i8*)*) #2
95
96declare void @__cxa_end_catch()
97
98; Function Attrs: nounwind readnone
99declare i32 @llvm.eh.typeid.for(i8*) #3
100
101; Function Attrs: nounwind
102declare i8* @__cxa_begin_catch(i8*) #1
103
104; Function Attrs: nounwind
105declare i32 @puts(i8* nocapture readonly) #1
106
107declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
108
109attributes #0 = { "no-frame-pointer-elim-non-leaf"="false" }
110attributes #1 = { nounwind }
111attributes #2 = { noreturn }
112attributes #3 = { nounwind readnone }
113