104 lines · plain
1; RUN: opt -O2 -S < %s | FileCheck %s2 3; Run global DCE to eliminate unused ctor and dtor.4; rdar://91428195 6; CHECK: main7; CHECK-NOT: _ZN4BaseC1Ev8; CHECK-NOT: _ZN4BaseD1Ev9; CHECK-NOT: _ZN4BaseD2Ev10; CHECK-NOT: _ZN4BaseC2Ev11; CHECK-NOT: _ZN4BaseD0Ev12 13%class.Base = type { ptr }14 15@_ZTV4Base = linkonce_odr unnamed_addr constant [4 x ptr] [ptr null, ptr @_ZTI4Base, ptr @_ZN4BaseD1Ev, ptr @_ZN4BaseD0Ev]16@_ZTVN10__cxxabiv117__class_type_infoE = external global ptr17@_ZTS4Base = linkonce_odr constant [6 x i8] c"4Base\00"18@_ZTI4Base = linkonce_odr unnamed_addr constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS4Base }19 20define i32 @main() uwtable ssp {21entry:22 %retval = alloca i32, align 423 %b = alloca %class.Base, align 824 %cleanup.dest.slot = alloca i3225 store i32 0, ptr %retval26 call void @_ZN4BaseC1Ev(ptr %b)27 store i32 0, ptr %retval28 store i32 1, ptr %cleanup.dest.slot29 call void @_ZN4BaseD1Ev(ptr %b)30 %0 = load i32, ptr %retval31 ret i32 %032}33 34define linkonce_odr void @_ZN4BaseC1Ev(ptr %this) unnamed_addr uwtable ssp align 2 {35entry:36 %this.addr = alloca ptr, align 837 store ptr %this, ptr %this.addr, align 838 %this1 = load ptr, ptr %this.addr39 call void @_ZN4BaseC2Ev(ptr %this1)40 ret void41}42 43define linkonce_odr void @_ZN4BaseD1Ev(ptr %this) unnamed_addr uwtable ssp align 2 {44entry:45 %this.addr = alloca ptr, align 846 store ptr %this, ptr %this.addr, align 847 %this1 = load ptr, ptr %this.addr48 call void @_ZN4BaseD2Ev(ptr %this1)49 ret void50}51 52define linkonce_odr void @_ZN4BaseD2Ev(ptr %this) unnamed_addr nounwind uwtable ssp align 2 {53entry:54 %this.addr = alloca ptr, align 855 store ptr %this, ptr %this.addr, align 856 %this1 = load ptr, ptr %this.addr57 ret void58}59 60define linkonce_odr void @_ZN4BaseC2Ev(ptr %this) unnamed_addr nounwind uwtable ssp align 2 {61entry:62 %this.addr = alloca ptr, align 863 store ptr %this, ptr %this.addr, align 864 %this1 = load ptr, ptr %this.addr65 store ptr getelementptr inbounds ([4 x ptr], ptr @_ZTV4Base, i64 0, i64 2), ptr %this166 ret void67}68 69define linkonce_odr void @_ZN4BaseD0Ev(ptr %this) unnamed_addr uwtable ssp align 2 personality ptr @__gxx_personality_v0 {70entry:71 %this.addr = alloca ptr, align 872 %exn.slot = alloca ptr73 %ehselector.slot = alloca i3274 store ptr %this, ptr %this.addr, align 875 %this1 = load ptr, ptr %this.addr76 invoke void @_ZN4BaseD1Ev(ptr %this1)77 to label %invoke.cont unwind label %lpad78 79invoke.cont: ; preds = %entry80 call void @_ZdlPv(ptr %this1) nounwind81 ret void82 83lpad: ; preds = %entry84 %0 = landingpad { ptr, i32 }85 cleanup86 %1 = extractvalue { ptr, i32 } %0, 087 store ptr %1, ptr %exn.slot88 %2 = extractvalue { ptr, i32 } %0, 189 store i32 %2, ptr %ehselector.slot90 call void @_ZdlPv(ptr %this1) nounwind91 br label %eh.resume92 93eh.resume: ; preds = %lpad94 %exn = load ptr, ptr %exn.slot95 %sel = load i32, ptr %ehselector.slot96 %lpad.val = insertvalue { ptr, i32 } undef, ptr %exn, 097 %lpad.val2 = insertvalue { ptr, i32 } %lpad.val, i32 %sel, 198 resume { ptr, i32 } %lpad.val299}100 101declare i32 @__gxx_personality_v0(...)102 103declare void @_ZdlPv(ptr) nounwind104