1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; ModuleID = 'pr44861.s'
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 %struct.shared_ptr = type { %struct.Foo*, %struct.shared_count }
7 %struct.Foo = type opaque
8 %struct.shared_count = type { %struct.counted_base* }
9 %struct.counted_base = type { i32 (...)** }
10 %struct.Bar = type { i8 }
12 define void @_Z1gv() uwtable {
14 %foo = alloca %struct.shared_ptr, align 8
15 %agg.tmp = alloca %struct.shared_ptr, align 8
16 call void @_ZN10shared_ptrC1Ev(%struct.shared_ptr* %foo)
17 %call = invoke noalias i8* @_Znwm(i64 1)
18 to label %invoke.cont unwind label %lpad
20 invoke.cont: ; preds = %entry
21 %tmp = bitcast i8* %call to %struct.Bar*
22 %call4 = invoke %struct.Foo* @_ZN10shared_ptrdeEv(%struct.shared_ptr* %foo)
23 to label %invoke.cont3 unwind label %lpad1
25 invoke.cont3: ; preds = %invoke.cont
26 invoke void @_ZN10shared_ptrC1ERS_(%struct.shared_ptr* %agg.tmp, %struct.shared_ptr* %foo)
27 to label %invoke.cont5 unwind label %lpad1
29 invoke.cont5: ; preds = %invoke.cont3
30 invoke void @_ZN3BarC1ER3Foo10shared_ptr(%struct.Bar* %tmp, %struct.Foo* %call4, %struct.shared_ptr* %agg.tmp)
31 to label %invoke.cont8 unwind label %lpad6
33 invoke.cont8: ; preds = %invoke.cont5
34 invoke void @_ZN10shared_ptrD1Ev(%struct.shared_ptr* %agg.tmp)
35 to label %invoke.cont9 unwind label %lpad1
37 invoke.cont9: ; preds = %invoke.cont8
38 call void @_ZN10shared_ptrD1Ev(%struct.shared_ptr* %foo)
41 lpad: ; preds = %entry
42 %exn = call i8* @llvm.eh.exception() nounwind
43 %tmp1 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exn, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 0) nounwind
44 br label %eh.cleanup11
46 lpad1: ; preds = %invoke.cont8, %invoke.cont3, %invoke.cont
47 %cleanup.isactive.0 = phi i1 [ false, %invoke.cont8 ], [ true, %invoke.cont3 ], [ true, %invoke.cont ]
48 %exn2 = call i8* @llvm.eh.exception() nounwind
49 %tmp2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exn2, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 0) nounwind
52 lpad6: ; preds = %invoke.cont5
53 %exn7 = call i8* @llvm.eh.exception() nounwind
54 %tmp3 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exn7, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i32 0) nounwind
55 invoke void @_ZN10shared_ptrD1Ev(%struct.shared_ptr* %agg.tmp)
56 to label %invoke.cont10 unwind label %terminate.lpad
58 invoke.cont10: ; preds = %lpad6
61 eh.cleanup: ; preds = %invoke.cont10, %lpad1
62 %cleanup.isactive.1 = phi i1 [ %cleanup.isactive.0, %lpad1 ], [ true, %invoke.cont10 ]
63 %ehselector.slot.0 = phi i32 [ %tmp2, %lpad1 ], [ %tmp3, %invoke.cont10 ]
64 %exn.slot.0 = phi i8* [ %exn2, %lpad1 ], [ %exn7, %invoke.cont10 ]
65 br i1 %cleanup.isactive.1, label %cleanup.action, label %cleanup.done
67 cleanup.action: ; preds = %eh.cleanup
68 call void @_ZdlPv(i8* %call) nounwind
69 br label %cleanup.done
71 cleanup.done: ; preds = %cleanup.action, %eh.cleanup
72 br label %eh.cleanup11
74 eh.cleanup11: ; preds = %cleanup.done, %lpad
75 %ehselector.slot.1 = phi i32 [ %ehselector.slot.0, %cleanup.done ], [ %tmp1, %lpad ]
76 %exn.slot.1 = phi i8* [ %exn.slot.0, %cleanup.done ], [ %exn, %lpad ]
77 invoke void @_ZN10shared_ptrD1Ev(%struct.shared_ptr* %foo)
78 to label %invoke.cont12 unwind label %terminate.lpad
80 invoke.cont12: ; preds = %eh.cleanup11
83 eh.resume: ; preds = %invoke.cont12
84 call void @llvm.eh.resume(i8* %exn.slot.1, i32 %ehselector.slot.1) noreturn
87 terminate.lpad: ; preds = %eh.cleanup11, %lpad6
88 %exn13 = call i8* @llvm.eh.exception() nounwind
89 %tmp4 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %exn13, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) nounwind
90 call void @_ZSt9terminatev() noreturn nounwind
94 define linkonce_odr void @_ZN10shared_ptrC1Ev(%struct.shared_ptr* %this) unnamed_addr uwtable inlinehint align 2 {
96 call void @_ZN10shared_ptrC2Ev(%struct.shared_ptr* %this)
100 declare noalias i8* @_Znwm(i64)
102 declare i8* @llvm.eh.exception() nounwind readonly
104 declare i32 @__gxx_personality_v0(...)
106 declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
108 declare i32 @llvm.eh.typeid.for(i8*) nounwind
110 declare void @llvm.eh.resume(i8*, i32)
112 declare void @_ZN3BarC1ER3Foo10shared_ptr(%struct.Bar*, %struct.Foo*, %struct.shared_ptr*)
114 define linkonce_odr %struct.Foo* @_ZN10shared_ptrdeEv(%struct.shared_ptr* %this) nounwind uwtable align 2 {
116 %ptr = getelementptr inbounds %struct.shared_ptr* %this, i64 0, i32 0
117 %tmp = load %struct.Foo** %ptr, align 8
118 ret %struct.Foo* %tmp
121 define linkonce_odr void @_ZN10shared_ptrC1ERS_(%struct.shared_ptr* %this, %struct.shared_ptr* %arg) unnamed_addr uwtable inlinehint align 2 {
123 call void @_ZN10shared_ptrC2ERS_(%struct.shared_ptr* %this, %struct.shared_ptr* %arg)
127 define linkonce_odr void @_ZN10shared_ptrD1Ev(%struct.shared_ptr* %this) unnamed_addr uwtable inlinehint align 2 {
129 call void @_ZN10shared_ptrD2Ev(%struct.shared_ptr* %this)
133 declare void @_ZSt9terminatev()
135 declare void @_ZdlPv(i8*) nounwind
137 define linkonce_odr void @_ZN10shared_ptrD2Ev(%struct.shared_ptr* %this) unnamed_addr uwtable inlinehint align 2 {
139 %refcount = getelementptr inbounds %struct.shared_ptr* %this, i64 0, i32 1
140 call void @_ZN12shared_countD1Ev(%struct.shared_count* %refcount)
144 define linkonce_odr void @_ZN12shared_countD1Ev(%struct.shared_count* %this) unnamed_addr uwtable align 2 {
146 call void @_ZN12shared_countD2Ev(%struct.shared_count* %this)
150 define linkonce_odr void @_ZN12shared_countD2Ev(%struct.shared_count* %this) unnamed_addr uwtable align 2 {
152 %pi = getelementptr inbounds %struct.shared_count* %this, i64 0, i32 0
153 %tmp = load %struct.counted_base** %pi, align 8
154 %tobool = icmp eq %struct.counted_base* %tmp, null
155 br i1 %tobool, label %if.end, label %if.then
157 if.then: ; preds = %entry
158 %pi2 = getelementptr inbounds %struct.shared_count* %this, i64 0, i32 0
159 %tmp3 = load %struct.counted_base** %pi2, align 8
160 call void @_ZN12counted_base7releaseEv(%struct.counted_base* %tmp3)
163 if.end: ; preds = %entry, %if.then
167 define linkonce_odr void @_ZN12counted_base7releaseEv(%struct.counted_base* %this) uwtable align 2 {
169 %call = call zeroext i1 @_Z1fv()
170 br i1 %call, label %if.then, label %if.end
172 if.then: ; preds = %entry
173 %tmp = bitcast %struct.counted_base* %this to void (%struct.counted_base*)***
174 %vtable = load void (%struct.counted_base*)*** %tmp, align 8
175 %tmp1 = load void (%struct.counted_base*)** %vtable, align 8
176 call void %tmp1(%struct.counted_base* %this)
179 if.end: ; preds = %if.then, %entry
183 declare zeroext i1 @_Z1fv()
185 define linkonce_odr void @_ZN10shared_ptrC2ERS_(%struct.shared_ptr* %this, %struct.shared_ptr* %arg) unnamed_addr uwtable inlinehint align 2 {
187 %ptr = getelementptr inbounds %struct.shared_ptr* %this, i64 0, i32 0
188 %ptr2 = getelementptr inbounds %struct.shared_ptr* %arg, i64 0, i32 0
189 %tmp3 = load %struct.Foo** %ptr2, align 8
190 store %struct.Foo* %tmp3, %struct.Foo** %ptr, align 8
191 %refcount = getelementptr inbounds %struct.shared_ptr* %this, i64 0, i32 1
192 %refcount5 = getelementptr inbounds %struct.shared_ptr* %arg, i64 0, i32 1
193 call void @_ZN12shared_countC1ERS_(%struct.shared_count* %refcount, %struct.shared_count* %refcount5)
197 define linkonce_odr void @_ZN12shared_countC1ERS_(%struct.shared_count* %this, %struct.shared_count* %r) unnamed_addr uwtable align 2 {
199 call void @_ZN12shared_countC2ERS_(%struct.shared_count* %this, %struct.shared_count* %r)
203 define linkonce_odr void @_ZN12shared_countC2ERS_(%struct.shared_count* %this, %struct.shared_count* %r) unnamed_addr uwtable align 2 {
205 %pi = getelementptr inbounds %struct.shared_count* %this, i64 0, i32 0
206 %pi2 = getelementptr inbounds %struct.shared_count* %r, i64 0, i32 0
207 %tmp3 = load %struct.counted_base** %pi2, align 8
208 store %struct.counted_base* %tmp3, %struct.counted_base** %pi, align 8
209 %tobool = icmp eq %struct.counted_base* %tmp3, null
210 br i1 %tobool, label %if.end, label %if.then
212 if.then: ; preds = %entry
213 %pi6 = getelementptr inbounds %struct.shared_count* %this, i64 0, i32 0
214 %tmp7 = load %struct.counted_base** %pi6, align 8
215 call void @_ZN12counted_base7releaseEv(%struct.counted_base* %tmp7)
218 if.end: ; preds = %entry, %if.then
222 define linkonce_odr void @_ZN10shared_ptrC2Ev(%struct.shared_ptr* %this) unnamed_addr uwtable inlinehint align 2 {
224 %refcount = getelementptr inbounds %struct.shared_ptr* %this, i64 0, i32 1
225 call void @_ZN12shared_countC1Ev(%struct.shared_count* %refcount)
229 define linkonce_odr void @_ZN12shared_countC1Ev(%struct.shared_count* %this) unnamed_addr uwtable align 2 {
231 call void @_ZN12shared_countC2Ev(%struct.shared_count* %this)
235 define linkonce_odr void @_ZN12shared_countC2Ev(%struct.shared_count* %this) unnamed_addr nounwind uwtable align 2 {