1 ; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=CHECK-MINGW-X86
3 %struct.as = type { ptr }
5 @_ZZ2amiE2au = internal unnamed_addr global %struct.as zeroinitializer, align 4
6 @_ZGVZ2amiE2au = internal global i64 0, align 8
7 @_ZTIi = external constant ptr
9 define void @_Z2ami(i32) #0 personality ptr @__gxx_personality_v0 {
10 ; CHECK-MINGW-X86-LABEL: _Z2ami:
11 ; CHECK-MINGW-X86: # %bb.0: # %entry
12 ; CHECK-MINGW-X86-NEXT: pushl %edi
13 ; CHECK-MINGW-X86-NEXT: .cfi_def_cfa_offset 8
14 ; CHECK-MINGW-X86-NEXT: pushl %esi
15 ; CHECK-MINGW-X86-NEXT: .cfi_def_cfa_offset 12
16 ; CHECK-MINGW-X86-NEXT: .cfi_offset %esi, -12
17 ; CHECK-MINGW-X86-NEXT: .cfi_offset %edi, -8
18 ; CHECK-MINGW-X86-NEXT: movzbl __ZGVZ2amiE2au, %eax
19 ; CHECK-MINGW-X86-NEXT: testb %al, %al
20 ; CHECK-MINGW-X86-NEXT: jne LBB0_4
21 ; CHECK-MINGW-X86-NEXT: # %bb.1: # %init.check
22 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
23 ; CHECK-MINGW-X86-NEXT: pushl $__ZGVZ2amiE2au
24 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
25 ; CHECK-MINGW-X86-NEXT: calll ___cxa_guard_acquire
26 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
27 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
28 ; CHECK-MINGW-X86-NEXT: testl %eax, %eax
29 ; CHECK-MINGW-X86-NEXT: je LBB0_4
30 ; CHECK-MINGW-X86-NEXT: # %bb.2: # %init
31 ; CHECK-MINGW-X86-NEXT: Ltmp0:
32 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
33 ; CHECK-MINGW-X86-NEXT: pushl $4
34 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
35 ; CHECK-MINGW-X86-NEXT: calll __Znwj
36 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
37 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
38 ; CHECK-MINGW-X86-NEXT: Ltmp1:
39 ; CHECK-MINGW-X86-NEXT: # %bb.3: # %invoke.cont
40 ; CHECK-MINGW-X86-NEXT: movl %eax, __ZZ2amiE2au
41 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
42 ; CHECK-MINGW-X86-NEXT: pushl $__ZGVZ2amiE2au
43 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
44 ; CHECK-MINGW-X86-NEXT: calll ___cxa_guard_release
45 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
46 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
47 ; CHECK-MINGW-X86-NEXT: LBB0_4: # %init.end
48 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
49 ; CHECK-MINGW-X86-NEXT: pushl $4
50 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
51 ; CHECK-MINGW-X86-NEXT: calll __Znwj
52 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
53 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
54 ; CHECK-MINGW-X86-NEXT: movl %eax, %esi
55 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
56 ; CHECK-MINGW-X86-NEXT: pushl $4
57 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
58 ; CHECK-MINGW-X86-NEXT: calll ___cxa_allocate_exception
59 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
60 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
61 ; CHECK-MINGW-X86-NEXT: movl $0, (%eax)
62 ; CHECK-MINGW-X86-NEXT: Ltmp3:
63 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x0c
64 ; CHECK-MINGW-X86-NEXT: movl .refptr.__ZTIi, %ecx
65 ; CHECK-MINGW-X86-NEXT: pushl $0
66 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
67 ; CHECK-MINGW-X86-NEXT: pushl %ecx
68 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
69 ; CHECK-MINGW-X86-NEXT: pushl %eax
70 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
71 ; CHECK-MINGW-X86-NEXT: calll ___cxa_throw
72 ; CHECK-MINGW-X86-NEXT: addl $12, %esp
73 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -12
74 ; CHECK-MINGW-X86-NEXT: Ltmp4:
75 ; CHECK-MINGW-X86-NEXT: # %bb.8: # %unreachable
76 ; CHECK-MINGW-X86-NEXT: LBB0_5: # %lpad
77 ; CHECK-MINGW-X86-NEXT: Ltmp2:
78 ; CHECK-MINGW-X86-NEXT: movl %eax, %edi
79 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
80 ; CHECK-MINGW-X86-NEXT: pushl $__ZGVZ2amiE2au
81 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
82 ; CHECK-MINGW-X86-NEXT: calll ___cxa_guard_abort
83 ; CHECK-MINGW-X86-NEXT: jmp LBB0_7
84 ; CHECK-MINGW-X86-NEXT: LBB0_6: # %lpad1
85 ; CHECK-MINGW-X86-NEXT: .cfi_def_cfa_offset 12
86 ; CHECK-MINGW-X86-NEXT: Ltmp5:
87 ; CHECK-MINGW-X86-NEXT: movl %eax, %edi
88 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
89 ; CHECK-MINGW-X86-NEXT: pushl %esi
90 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
91 ; CHECK-MINGW-X86-NEXT: calll __ZdlPv
92 ; CHECK-MINGW-X86-NEXT: LBB0_7: # %eh.resume
93 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
94 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
95 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
96 ; CHECK-MINGW-X86-NEXT: pushl %edi
97 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
98 ; CHECK-MINGW-X86-NEXT: calll __Unwind_Resume
99 ; CHECK-MINGW-X86-NEXT: Lfunc_end0:
101 %1 = load atomic i8, ptr @_ZGVZ2amiE2au acquire, align 8
102 %guard.uninitialized = icmp eq i8 %1, 0
103 br i1 %guard.uninitialized, label %init.check, label %init.end
105 init.check: ; preds = %entry
106 %2 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ2amiE2au)
107 %tobool = icmp eq i32 %2, 0
108 br i1 %tobool, label %init.end, label %init
110 init: ; preds = %init.check
111 %call.i3 = invoke ptr @_Znwj(i32 4)
112 to label %invoke.cont unwind label %lpad
114 invoke.cont: ; preds = %init
115 store ptr %call.i3, ptr @_ZZ2amiE2au, align 4
116 tail call void @__cxa_guard_release(ptr nonnull @_ZGVZ2amiE2au)
119 init.end: ; preds = %init.check, %invoke.cont, %entry
120 %call.i = tail call ptr @_Znwj(i32 4)
121 %exception = tail call ptr @__cxa_allocate_exception(i32 4)
122 store i32 0, ptr %exception, align 16
123 invoke void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
124 to label %unreachable unwind label %lpad1
126 lpad: ; preds = %init
127 %3 = landingpad { ptr, i32 }
129 %4 = extractvalue { ptr, i32 } %3, 0
130 %5 = extractvalue { ptr, i32 } %3, 1
131 tail call void @__cxa_guard_abort(ptr nonnull @_ZGVZ2amiE2au) #1
134 lpad1: ; preds = %init.end
135 %6 = landingpad { ptr, i32 }
137 %7 = extractvalue { ptr, i32 } %6, 0
138 %8 = extractvalue { ptr, i32 } %6, 1
139 tail call void @_ZdlPv(ptr nonnull %call.i)
142 eh.resume: ; preds = %lpad1, %lpad
143 %exn.slot.0 = phi ptr [ %7, %lpad1 ], [ %4, %lpad ]
144 %ehselector.slot.0 = phi i32 [ %8, %lpad1 ], [ %5, %lpad ]
145 %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn.slot.0, 0
146 %lpad.val2 = insertvalue { ptr, i32 } %lpad.val, i32 %ehselector.slot.0, 1
147 resume { ptr, i32 } %lpad.val2
149 unreachable: ; preds = %init.end
153 declare i32 @__cxa_guard_acquire(ptr)
154 declare i32 @__gxx_personality_v0(...)
155 declare void @__cxa_guard_abort(ptr)
156 declare void @__cxa_guard_release(ptr)
157 declare ptr @__cxa_allocate_exception(i32)
158 declare void @__cxa_throw(ptr, ptr, ptr)
159 declare noalias nonnull ptr @_Znwj(i32)
160 declare ptr @__cxa_begin_catch(ptr)
161 declare void @__cxa_end_catch()
162 declare void @_ZdlPv(ptr)