1; RUN: opt < %s -disable-output -jump-threading 2 3%class.E = type { i32 (...)**, %class.C } 4%class.C = type { %class.A } 5%class.A = type { i32 } 6%class.D = type { %class.F } 7%class.F = type { %class.E } 8%class.B = type { %class.D* } 9 10@_ZTV1D = unnamed_addr constant [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTI1D to i8*), i8* bitcast (void (%class.D*)* @_ZN1D7doApplyEv to i8*)] 11@_ZTI1D = external unnamed_addr constant { i8*, i8*, i8* } 12 13define void @_ZN15EditCommandImpl5applyEv(%class.E* %this) uwtable align 2 { 14entry: 15 %0 = bitcast %class.E* %this to void (%class.E*)*** 16 %vtable = load void (%class.E*)**, void (%class.E*)*** %0, align 8 17 %1 = load void (%class.E*)*, void (%class.E*)** %vtable, align 8 18 call void %1(%class.E* %this) 19 ret void 20} 21 22define void @_ZN1DC1Ev(%class.D* nocapture %this) unnamed_addr uwtable align 2 { 23entry: 24 call void @_ZN24CompositeEditCommandImplC2Ev() 25 %0 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 0, i32 0, i32 0 26 store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8 27 ret void 28} 29 30define void @_ZN1DC2Ev(%class.D* nocapture %this) unnamed_addr uwtable align 2 { 31entry: 32 call void @_ZN24CompositeEditCommandImplC2Ev() 33 %0 = getelementptr inbounds %class.D, %class.D* %this, i64 0, i32 0, i32 0, i32 0 34 store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8 35 ret void 36} 37 38declare void @_ZN24CompositeEditCommandImplC2Ev() #1 39 40define void @_ZN1D7doApplyEv(%class.D* nocapture %this) unnamed_addr nounwind readnone uwtable align 2 { 41entry: 42 ret void 43} 44 45define void @_Z3fn1v() uwtable { 46entry: 47 %call = call noalias i8* @_Znwm() #8 48 invoke void @_ZN24CompositeEditCommandImplC2Ev() 49 to label %_ZN1DC1Ev.exit unwind label %lpad 50 51_ZN1DC1Ev.exit: ; preds = %entry 52 %0 = bitcast i8* %call to i32 (...)*** 53 store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTV1D, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8 54 %_ref.i.i.i = getelementptr inbounds i8, i8* %call, i64 8 55 %1 = bitcast i8* %_ref.i.i.i to i32* 56 %2 = load i32, i32* %1, align 4 57 %inc.i.i.i = add nsw i32 %2, 1 58 store i32 %inc.i.i.i, i32* %1, align 4 59 %3 = bitcast i8* %call to %class.D* 60 invoke void @_ZN1D7doApplyEv(%class.D* %3) 61 to label %_ZN15EditCommandImpl5applyEv.exit unwind label %lpad1 62 63_ZN15EditCommandImpl5applyEv.exit: ; preds = %_ZN1DC1Ev.exit 64 invoke void @_ZN1D16deleteKeyPressedEv() 65 to label %invoke.cont7 unwind label %lpad1 66 67invoke.cont7: ; preds = %_ZN15EditCommandImpl5applyEv.exit 68 ret void 69 70lpad: ; preds = %entry 71 %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 72 cleanup 73 call void @_ZdlPv() #9 74 unreachable 75 76lpad1: ; preds = %_ZN1DC1Ev.exit, %_ZN15EditCommandImpl5applyEv.exit 77 %5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 78 cleanup 79 %6 = load i32, i32* %1, align 4 80 %tobool.i.i.i = icmp eq i32 %6, 0 81 br i1 %tobool.i.i.i, label %_ZN1BI1DED1Ev.exit, label %if.then.i.i.i 82 83if.then.i.i.i: ; preds = %lpad1 84 br i1 undef, label %_ZN1BI1DED1Ev.exit, label %delete.notnull.i.i.i 85 86delete.notnull.i.i.i: ; preds = %if.then.i.i.i 87 call void @_ZdlPv() #9 88 unreachable 89 90_ZN1BI1DED1Ev.exit: ; preds = %lpad1, %if.then.i.i.i 91 resume { i8*, i32 } undef 92 93terminate.lpad: ; No predecessors! 94 %7 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 95 catch i8* null 96 unreachable 97} 98 99define void @_ZN1BI1DEC1EPS0_(%class.B* nocapture %this, %class.D* %p1) unnamed_addr uwtable align 2 { 100entry: 101 %m_ptr.i = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0 102 store %class.D* %p1, %class.D** %m_ptr.i, align 8 103 %_ref.i.i = getelementptr inbounds %class.D, %class.D* %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0 104 %0 = load i32, i32* %_ref.i.i, align 4 105 %inc.i.i = add nsw i32 %0, 1 106 store i32 %inc.i.i, i32* %_ref.i.i, align 4 107 ret void 108} 109 110declare noalias i8* @_Znwm() 111 112declare i32 @__gxx_personality_v0(...) 113 114declare void @_ZdlPv() 115 116define %class.D* @_ZN1BI1DEptEv(%class.B* nocapture readonly %this) nounwind readonly uwtable align 2 { 117entry: 118 %m_ptr = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0 119 %0 = load %class.D*, %class.D** %m_ptr, align 8 120 ret %class.D* %0 121} 122 123declare void @_ZN1D16deleteKeyPressedEv() 124 125define void @_ZN1BI1DED1Ev(%class.B* nocapture readonly %this) unnamed_addr uwtable align 2 { 126entry: 127 %m_ptr.i = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0 128 %0 = load %class.D*, %class.D** %m_ptr.i, align 8 129 %_ref.i.i = getelementptr inbounds %class.D, %class.D* %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0 130 %1 = load i32, i32* %_ref.i.i, align 4 131 %tobool.i.i = icmp eq i32 %1, 0 132 br i1 %tobool.i.i, label %_ZN1BI1DED2Ev.exit, label %if.then.i.i 133 134if.then.i.i: ; preds = %entry 135 br i1 undef, label %_ZN1BI1DED2Ev.exit, label %delete.notnull.i.i 136 137delete.notnull.i.i: ; preds = %if.then.i.i 138 call void @_ZdlPv() #9 139 unreachable 140 141_ZN1BI1DED2Ev.exit: ; preds = %entry, %if.then.i.i 142 ret void 143} 144 145declare hidden void @__clang_call_terminate() 146 147define void @_ZN1BI1DED2Ev(%class.B* nocapture readonly %this) unnamed_addr uwtable align 2 { 148entry: 149 %m_ptr = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0 150 %0 = load %class.D*, %class.D** %m_ptr, align 8 151 %_ref.i = getelementptr inbounds %class.D, %class.D* %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0 152 %1 = load i32, i32* %_ref.i, align 4 153 %tobool.i = icmp eq i32 %1, 0 154 br i1 %tobool.i, label %_ZN1AI1CE5derefEv.exit, label %if.then.i 155 156if.then.i: ; preds = %entry 157 br i1 undef, label %_ZN1AI1CE5derefEv.exit, label %delete.notnull.i 158 159delete.notnull.i: ; preds = %if.then.i 160 call void @_ZdlPv() #9 161 unreachable 162 163_ZN1AI1CE5derefEv.exit: ; preds = %entry, %if.then.i 164 ret void 165} 166 167define void @_ZN1AI1CE5derefEv(%class.A* nocapture readonly %this) nounwind uwtable align 2 { 168entry: 169 %_ref = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0 170 %0 = load i32, i32* %_ref, align 4 171 %tobool = icmp eq i32 %0, 0 172 br i1 %tobool, label %if.end, label %if.then 173 174if.then: ; preds = %entry 175 br i1 undef, label %if.end, label %delete.notnull 176 177delete.notnull: ; preds = %if.then 178 call void @_ZdlPv() #9 179 unreachable 180 181if.end: ; preds = %entry, %if.then 182 ret void 183} 184 185define void @_ZN1BI1DEC2EPS0_(%class.B* nocapture %this, %class.D* %p1) unnamed_addr uwtable align 2 { 186entry: 187 %m_ptr = getelementptr inbounds %class.B, %class.B* %this, i64 0, i32 0 188 store %class.D* %p1, %class.D** %m_ptr, align 8 189 %_ref.i = getelementptr inbounds %class.D, %class.D* %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0 190 %0 = load i32, i32* %_ref.i, align 4 191 %inc.i = add nsw i32 %0, 1 192 store i32 %inc.i, i32* %_ref.i, align 4 193 ret void 194} 195 196define void @_ZN1AI1CE3refEv(%class.A* nocapture %this) nounwind uwtable align 2 { 197entry: 198 %_ref = getelementptr inbounds %class.A, %class.A* %this, i64 0, i32 0 199 %0 = load i32, i32* %_ref, align 4 200 %inc = add nsw i32 %0, 1 201 store i32 %inc, i32* %_ref, align 4 202 ret void 203} 204