1 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=sparc -relocation-model=static | FileCheck -check-prefix=V8ABS %s
2 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=sparc -relocation-model=pic | FileCheck -check-prefix=V8PIC %s
3 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=sparcv9 -relocation-model=static | FileCheck -check-prefix=V9ABS %s
4 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=sparcv9 -relocation-model=pic | FileCheck -check-prefix=V9PIC %s
7 %struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
8 %struct.__type_info_pseudo = type { ptr, ptr }
10 @_ZTIi = external constant %struct.__fundamental_type_info_pseudo
11 @_ZTIf = external constant %struct.__fundamental_type_info_pseudo
12 @.cst = private unnamed_addr constant [12 x i8] c"catched int\00", align 64
13 @.cst1 = private unnamed_addr constant [14 x i8] c"catched float\00", align 64
16 ; V8ABS: .cfi_startproc
17 ; V8ABS: .cfi_personality 0, __gxx_personality_v0
19 ; V8ABS: .cfi_def_cfa_register {{30|%fp}}
20 ; V8ABS: .cfi_window_save
21 ; V8ABS: .cfi_register %o7, %i7
23 ; V8ABS: call __cxa_throw
24 ; V8ABS: call __cxa_throw
26 ; V8ABS: call __cxa_begin_catch
27 ; V8ABS: call __cxa_end_catch
29 ; V8ABS: call __cxa_begin_catch
30 ; V8ABS: call __cxa_end_catch
35 ; V8PIC: .cfi_startproc
36 ; V8PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
37 ; V8PIC: .cfi_lsda 27,
38 ; V8PIC: .cfi_def_cfa_register {{30|%fp}}
39 ; V8PIC: .cfi_window_save
40 ; V8PIC: .cfi_register %o7, %i7
41 ; V8PIC: .section .gcc_except_table
43 ; V8PIC: .word %r_disp32(.L_ZTIi.DW.stub)
45 ; V8PIC: .L_ZTIi.DW.stub:
46 ; V8PIC-NEXT: .word _ZTIi
50 ; V9ABS: .cfi_startproc
51 ; V9ABS: .cfi_personality 0, __gxx_personality_v0
52 ; V9ABS: .cfi_lsda 27,
53 ; V9ABS: .cfi_def_cfa_register {{30|%fp}}
54 ; V9ABS: .cfi_window_save
55 ; V9ABS: .cfi_register %o7, %i7
56 ; V9ABS: .section .gcc_except_table
61 ; V9PIC: .cfi_startproc
62 ; V9PIC: .cfi_personality 155, DW.ref.__gxx_personality_v0
63 ; V9PIC: .cfi_lsda 27,
64 ; V9PIC: .cfi_def_cfa_register {{30|%fp}}
65 ; V9PIC: .cfi_window_save
66 ; V9PIC: .cfi_register %o7, %i7
67 ; V9PIC: .section .gcc_except_table
69 ; V9PIC: .word %r_disp32(.L_ZTIi.DW.stub)
71 ; V9PIC: .L_ZTIi.DW.stub:
72 ; V9PIC-NEXT: .xword _ZTIi
74 define i32 @main(i32 %argc, ptr nocapture readnone %argv) unnamed_addr #0 personality ptr @__gxx_personality_v0 {
76 %0 = icmp eq i32 %argc, 2
77 %1 = tail call ptr @__cxa_allocate_exception(i32 4) #1
78 br i1 %0, label %"3", label %"4"
81 %2 = bitcast ptr %1 to ptr
82 store i32 0, ptr %2, align 4
83 invoke void @__cxa_throw(ptr %1, ptr @_ZTIi, ptr null) #2
84 to label %3 unwind label %"8"
86 ; <label>:3 ; preds = %"3"
90 %4 = bitcast ptr %1 to ptr
91 store float 1.000000e+00, ptr %4, align 4
94 invoke void @__cxa_throw(ptr %1, ptr @_ZTIf, ptr null) #2
95 to label %5 unwind label %"8"
97 ; <label>:5 ; preds = %"4"
100 "5": ; preds = %"13", %"11"
101 %6 = phi i32 [ 2, %"13" ], [ 0, %"11" ]
104 "8": ; preds = %"4", %"3"
105 %exc = landingpad { ptr, i32 }
108 %exc_ptr12 = extractvalue { ptr, i32 } %exc, 0
109 %filter13 = extractvalue { ptr, i32 } %exc, 1
110 %typeid = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
111 %7 = icmp eq i32 %filter13, %typeid
112 br i1 %7, label %"11", label %8
114 ; <label>:8 ; preds = %"8"
115 %typeid8 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIf)
116 %9 = icmp eq i32 %filter13, %typeid8
117 br i1 %9, label %"13", label %"9"
120 resume { ptr, i32 } %exc
123 %10 = tail call ptr @__cxa_begin_catch(ptr %exc_ptr12) #1
124 %11 = tail call i32 @puts(ptr @.cst)
125 tail call void @__cxa_end_catch() #1
129 %12 = tail call ptr @__cxa_begin_catch(ptr %exc_ptr12) #1
130 %13 = tail call i32 @puts(ptr @.cst1)
131 tail call void @__cxa_end_catch() #1
135 ; Function Attrs: nounwind
136 declare ptr @__cxa_allocate_exception(i32) #1
138 ; Function Attrs: noreturn
139 declare void @__cxa_throw(ptr, ptr, ptr) #2
141 declare void @__cxa_end_catch()
143 ; Function Attrs: nounwind readnone
144 declare i32 @llvm.eh.typeid.for(ptr) #3
146 ; Function Attrs: nounwind
147 declare ptr @__cxa_begin_catch(ptr) #1
149 ; Function Attrs: nounwind
150 declare i32 @puts(ptr nocapture readonly) #1
152 declare i32 @__gxx_personality_v0(i32, i64, ptr, ptr)
154 attributes #0 = { "frame-pointer"="none" }
155 attributes #1 = { nounwind }
156 attributes #2 = { noreturn }
157 attributes #3 = { nounwind readnone }