brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · ac9c362 Raw
90 lines · plain
1; RUN: opt < %s -passes=globaldce -S | FileCheck %s2 3; structs A, B and C have vcall_visibility of public, linkage-unit and4; translation-unit respectively. This test is run before LTO linking occurs5; so only C can be VFE'd.6 7target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"8 9%struct.A = type { ptr }10 11@_ZTV1A = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN1A3fooEv] }, align 8, !type !0, !type !1, !vcall_visibility !212 13define internal void @_ZN1AC2Ev(ptr %this) {14entry:15  store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV1A, i64 0, i32 0, i64 2), ptr %this, align 816  ret void17}18 19; CHECK: define {{.*}} @_ZN1A3fooEv(20define internal void @_ZN1A3fooEv(ptr nocapture %this) {21entry:22  ret void23}24 25define dso_local ptr @_Z6make_Av() {26entry:27  %call = tail call ptr @_Znwm(i64 8)28  tail call void @_ZN1AC2Ev(ptr %call)29  ret ptr %call30}31 32 33%struct.B = type { ptr }34 35@_ZTV1B = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN1B3fooEv] }, align 8, !type !0, !type !1, !vcall_visibility !336 37define internal void @_ZN1BC2Ev(ptr %this) {38entry:39  store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV1B, i64 0, i32 0, i64 2), ptr %this, align 840  ret void41}42 43; CHECK: define {{.*}} @_ZN1B3fooEv(44define internal void @_ZN1B3fooEv(ptr nocapture %this) {45entry:46  ret void47}48 49define dso_local ptr @_Z6make_Bv() {50entry:51  %call = tail call ptr @_Znwm(i64 8)52  tail call void @_ZN1BC2Ev(ptr %call)53  ret ptr %call54}55 56 57%struct.C = type { ptr }58 59@_ZTV1C = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN1C3fooEv] }, align 8, !type !0, !type !1, !vcall_visibility !460 61define internal void @_ZN1CC2Ev(ptr %this) {62entry:63  store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV1C, i64 0, i32 0, i64 2), ptr %this, align 864  ret void65}66 67; CHECK-NOT: define {{.*}} @_ZN1C3fooEv(68define internal void @_ZN1C3fooEv(ptr nocapture %this) {69entry:70  ret void71}72 73define dso_local ptr @_Z6make_Cv() {74entry:75  %call = tail call ptr @_Znwm(i64 8)76  tail call void @_ZN1CC2Ev(ptr %call)77  ret ptr %call78}79 80declare dso_local noalias nonnull ptr @_Znwm(i64)81 82!llvm.module.flags = !{!5}83 84!0 = !{i64 16, !"_ZTS1A"}85!1 = !{i64 16, !"_ZTSM1AFvvE.virtual"}86!2 = !{i64 0} ; public vcall visibility87!3 = !{i64 1} ; linkage-unit vcall visibility88!4 = !{i64 2} ; translation-unit vcall visibility89!5 = !{i32 1, !"Virtual Function Elim", i32 1}90