Skip to content

Commit f12edd1

Browse files
resolve comments
1 parent 27b1e88 commit f12edd1

File tree

1 file changed

+6
-36
lines changed

1 file changed

+6
-36
lines changed

llvm/test/ThinLTO/X86/devirt_prevailing.ll

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: rm -rf %t && mkdir %t && cd %t
22

33
; Tests that devirtualization is suppressed on a class when the LTO unit doesn't
4-
; have the prevailing definition of the class.
4+
; have the prevailing definition of the base class.
55

66
; Generate unsplit module with summary for ThinLTO index-based WPD.
77
; RUN: opt -thinlto-bc -o summary.o %s
@@ -16,10 +16,7 @@
1616
; RUN: --whole-program-visibility-enabled-in-lto=true \
1717
; RUN: --validate-all-vtables-have-type-infos=true \
1818
; RUN: --all-vtables-have-type-infos=true \
19-
; RUN: -r=summary.o,__cxa_pure_virtual, \
20-
; RUN: -r=summary.o,_ZN8DerivedNC2Ev,x \
2119
; RUN: -r=summary.o,_ZN4Base8dispatchEv,px \
22-
; RUN: -r=summary.o,_ZN7DerivedC2Ev, \
2320
; RUN: -r=summary.o,_ZN8DerivedN5printEv,px \
2421
; RUN: -r=summary.o,_ZTV8DerivedN,p \
2522
; RUN: -r=summary.o,_ZTI8DerivedN,p \
@@ -38,10 +35,7 @@
3835
; RUN: --whole-program-visibility-enabled-in-lto=true \
3936
; RUN: --validate-all-vtables-have-type-infos=true \
4037
; RUN: --all-vtables-have-type-infos=true \
41-
; RUN: -r=summary.o,__cxa_pure_virtual, \
42-
; RUN: -r=summary.o,_ZN8DerivedNC2Ev,x \
4338
; RUN: -r=summary.o,_ZN4Base8dispatchEv,px \
44-
; RUN: -r=summary.o,_ZN7DerivedC2Ev, \
4539
; RUN: -r=summary.o,_ZN8DerivedN5printEv,px \
4640
; RUN: -r=summary.o,_ZTV8DerivedN,p \
4741
; RUN: -r=summary.o,_ZTI8DerivedN,p \
@@ -58,10 +52,7 @@
5852
; RUN: --whole-program-visibility-enabled-in-lto=true \
5953
; RUN: --validate-all-vtables-have-type-infos=true \
6054
; RUN: --all-vtables-have-type-infos=true \
61-
; RUN: -r=hybrid.o,__cxa_pure_virtual, \
62-
; RUN: -r=hybrid.o,_ZN8DerivedNC2Ev,x \
6355
; RUN: -r=hybrid.o,_ZN4Base8dispatchEv,px \
64-
; RUN: -r=hybrid.o,_ZN7DerivedC2Ev, \
6556
; RUN: -r=hybrid.o,_ZN8DerivedN5printEv,px \
6657
; RUN: -r=hybrid.o,_ZTV8DerivedN, \
6758
; RUN: -r=hybrid.o,_ZTI8DerivedN, \
@@ -79,10 +70,7 @@
7970
; RUN: --whole-program-visibility-enabled-in-lto=true \
8071
; RUN: --validate-all-vtables-have-type-infos=true \
8172
; RUN: --all-vtables-have-type-infos=true \
82-
; RUN: -r=hybrid.o,__cxa_pure_virtual, \
83-
; RUN: -r=hybrid.o,_ZN8DerivedNC2Ev,x \
8473
; RUN: -r=hybrid.o,_ZN4Base8dispatchEv,px \
85-
; RUN: -r=hybrid.o,_ZN7DerivedC2Ev, \
8674
; RUN: -r=hybrid.o,_ZN8DerivedN5printEv,px \
8775
; RUN: -r=hybrid.o,_ZTV8DerivedN, \
8876
; RUN: -r=hybrid.o,_ZTI8DerivedN, \
@@ -103,10 +91,7 @@
10391
; RUN: --whole-program-visibility-enabled-in-lto=true \
10492
; RUN: --validate-all-vtables-have-type-infos=true \
10593
; RUN: --all-vtables-have-type-infos=true \
106-
; RUN: -r=regular.o,__cxa_pure_virtual, \
107-
; RUN: -r=regular.o,_ZN8DerivedNC2Ev,x \
10894
; RUN: -r=regular.o,_ZN4Base8dispatchEv,px \
109-
; RUN: -r=regular.o,_ZN7DerivedC2Ev, \
11095
; RUN: -r=regular.o,_ZN8DerivedN5printEv,px \
11196
; RUN: -r=regular.o,_ZTS8DerivedN,p \
11297
; RUN: -r=regular.o,_ZTI7Derived,p \
@@ -120,10 +105,7 @@
120105
; RUN: --whole-program-visibility-enabled-in-lto=true \
121106
; RUN: --validate-all-vtables-have-type-infos=true \
122107
; RUN: --all-vtables-have-type-infos=true \
123-
; RUN: -r=regular.o,__cxa_pure_virtual, \
124-
; RUN: -r=regular.o,_ZN8DerivedNC2Ev,x \
125108
; RUN: -r=regular.o,_ZN4Base8dispatchEv,px \
126-
; RUN: -r=regular.o,_ZN7DerivedC2Ev, \
127109
; RUN: -r=regular.o,_ZN8DerivedN5printEv,px \
128110
; RUN: -r=regular.o,_ZTS8DerivedN,p \
129111
; RUN: -r=regular.o,_ZTI7Derived, \
@@ -136,12 +118,14 @@
136118
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
137119
target triple = "x86_64-unknown-linux-gnu"
138120

139-
@_ZTV8DerivedN = linkonce_odr hidden constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr @_ZTI8DerivedN, ptr @_ZN8DerivedN5printEv] }, !type !0, !type !1, !type !2, !type !3, !vcall_visibility !6
121+
@_ZTV8DerivedN = linkonce_odr hidden constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr @_ZTI8DerivedN, ptr @_ZN8DerivedN5printEv] }, !type !0, !type !1, !type !2, !type !3, !vcall_visibility !4
140122
@_ZTI8DerivedN = linkonce_odr hidden constant { ptr, ptr, ptr } { ptr null, ptr @_ZTS8DerivedN, ptr @_ZTI7Derived }
141123
@_ZTS8DerivedN = linkonce_odr hidden constant [10 x i8] c"8DerivedN\00", align 1
142124
@_ZTI7Derived = external constant ptr
143125

144-
@llvm.used = appending global [1 x ptr] [ptr @_ZN8DerivedNC2Ev], section "llvm.metadata"
126+
; Whole program devirtualization will ignore summaries that are not live.
127+
; Mark '_ZTV8DerivedN' as used so it remains live.
128+
@llvm.used = appending global [1 x ptr] [ptr @_ZTV8DerivedN], section "llvm.metadata"
145129

146130
define hidden void @_ZN4Base8dispatchEv(ptr %this) {
147131
entry:
@@ -157,32 +141,18 @@ entry:
157141
ret void
158142
}
159143

160-
define linkonce_odr hidden void @_ZN8DerivedNC2Ev(ptr %this) #0 {
161-
entry:
162-
%this.addr = alloca ptr
163-
store ptr %this, ptr %this.addr
164-
%this1 = load ptr, ptr %this.addr
165-
call void @_ZN7DerivedC2Ev(ptr %this1)
166-
store ptr getelementptr inbounds inrange(-16, 8) ({ [3 x ptr] }, ptr @_ZTV8DerivedN, i32 0, i32 0, i32 2), ptr %this1
167-
ret void
168-
}
169-
170144
define linkonce_odr hidden void @_ZN8DerivedN5printEv(ptr %this) #0 {
171145
entry:
172146
ret void
173147
}
174148

175149
attributes #0 = { noinline optnone }
176150

177-
declare void @__cxa_pure_virtual()
178151
declare i1 @llvm.type.test(ptr, metadata)
179152
declare void @llvm.assume(i1)
180-
declare void @_ZN7DerivedC2Ev(ptr)
181153

182154
!0 = !{i64 16, !"_ZTS7Derived"}
183155
!1 = !{i64 16, !"_ZTSM7DerivedFvvE.virtual"}
184156
!2 = !{i64 16, !"_ZTS8DerivedN"}
185157
!3 = !{i64 16, !"_ZTSM8DerivedNFvvE.virtual"}
186-
;!4 = !{i64 16, !"_ZTS8DerivedN"}
187-
;!5 = !{i64 16, !"_ZTSM8DerivedNFvvE.virtual"}
188-
!6 = !{i64 0}
158+
!4 = !{i64 0}

0 commit comments

Comments
 (0)