llvm.org GIT mirror llvm / aa7e474
Add test case for r164850. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164867 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 7 years ago
1 changed file(s) with 106 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt -O2 -S %s | FileCheck %s
1
2 ; Run global DCE to eliminate unused ctor and dtor.
3 ; rdar://9142819
4
5 ; CHECK: main
6 ; CHECK-NOT: _ZN4BaseC1Ev
7 ; CHECK-NOT: _ZN4BaseD1Ev
8 ; CHECK-NOT: _ZN4BaseD2Ev
9 ; CHECK-NOT: _ZN4BaseC2Ev
10 ; CHECK-NOT: _ZN4BaseD0Ev
11
12 %class.Base = type { i32 (...)** }
13
14 @_ZTV4Base = linkonce_odr unnamed_addr constant [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI4Base to i8*), i8* bitcast (void (%class.Base*)* @_ZN4BaseD1Ev to i8*), i8* bitcast (void (%class.Base*)* @_ZN4BaseD0Ev to i8*)]
15 @_ZTVN10__cxxabiv117__class_type_infoE = external global i8*
16 @_ZTS4Base = linkonce_odr constant [6 x i8] c"4Base\00"
17 @_ZTI4Base = linkonce_odr unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([6 x i8]* @_ZTS4Base, i32 0, i32 0) }
18
19 define i32 @main() uwtable ssp {
20 entry:
21 %retval = alloca i32, align 4
22 %b = alloca %class.Base, align 8
23 %cleanup.dest.slot = alloca i32
24 store i32 0, i32* %retval
25 call void @_ZN4BaseC1Ev(%class.Base* %b)
26 store i32 0, i32* %retval
27 store i32 1, i32* %cleanup.dest.slot
28 call void @_ZN4BaseD1Ev(%class.Base* %b)
29 %0 = load i32* %retval
30 ret i32 %0
31 }
32
33 define linkonce_odr void @_ZN4BaseC1Ev(%class.Base* %this) unnamed_addr uwtable ssp align 2 {
34 entry:
35 %this.addr = alloca %class.Base*, align 8
36 store %class.Base* %this, %class.Base** %this.addr, align 8
37 %this1 = load %class.Base** %this.addr
38 call void @_ZN4BaseC2Ev(%class.Base* %this1)
39 ret void
40 }
41
42 define linkonce_odr void @_ZN4BaseD1Ev(%class.Base* %this) unnamed_addr uwtable ssp align 2 {
43 entry:
44 %this.addr = alloca %class.Base*, align 8
45 store %class.Base* %this, %class.Base** %this.addr, align 8
46 %this1 = load %class.Base** %this.addr
47 call void @_ZN4BaseD2Ev(%class.Base* %this1)
48 ret void
49 }
50
51 define linkonce_odr void @_ZN4BaseD2Ev(%class.Base* %this) unnamed_addr nounwind uwtable ssp align 2 {
52 entry:
53 %this.addr = alloca %class.Base*, align 8
54 store %class.Base* %this, %class.Base** %this.addr, align 8
55 %this1 = load %class.Base** %this.addr
56 ret void
57 }
58
59 define linkonce_odr void @_ZN4BaseC2Ev(%class.Base* %this) unnamed_addr nounwind uwtable ssp align 2 {
60 entry:
61 %this.addr = alloca %class.Base*, align 8
62 store %class.Base* %this, %class.Base** %this.addr, align 8
63 %this1 = load %class.Base** %this.addr
64 %0 = bitcast %class.Base* %this1 to i8***
65 store i8** getelementptr inbounds ([4 x i8*]* @_ZTV4Base, i64 0, i64 2), i8*** %0
66 ret void
67 }
68
69 define linkonce_odr void @_ZN4BaseD0Ev(%class.Base* %this) unnamed_addr uwtable ssp align 2 {
70 entry:
71 %this.addr = alloca %class.Base*, align 8
72 %exn.slot = alloca i8*
73 %ehselector.slot = alloca i32
74 store %class.Base* %this, %class.Base** %this.addr, align 8
75 %this1 = load %class.Base** %this.addr
76 invoke void @_ZN4BaseD1Ev(%class.Base* %this1)
77 to label %invoke.cont unwind label %lpad
78
79 invoke.cont: ; preds = %entry
80 %0 = bitcast %class.Base* %this1 to i8*
81 call void @_ZdlPv(i8* %0) nounwind
82 ret void
83
84 lpad: ; preds = %entry
85 %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
86 cleanup
87 %2 = extractvalue { i8*, i32 } %1, 0
88 store i8* %2, i8** %exn.slot
89 %3 = extractvalue { i8*, i32 } %1, 1
90 store i32 %3, i32* %ehselector.slot
91 %4 = bitcast %class.Base* %this1 to i8*
92 call void @_ZdlPv(i8* %4) nounwind
93 br label %eh.resume
94
95 eh.resume: ; preds = %lpad
96 %exn = load i8** %exn.slot
97 %sel = load i32* %ehselector.slot
98 %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn, 0
99 %lpad.val2 = insertvalue { i8*, i32 } %lpad.val, i32 %sel, 1
100 resume { i8*, i32 } %lpad.val2
101 }
102
103 declare i32 @__gxx_personality_v0(...)
104
105 declare void @_ZdlPv(i8*) nounwind