2727; NOENABLESPLITFLAG-DAG: [[B:\^[0-9]+]] = gv: (name: "_ZTV1B", {{.*}} vTableFuncs: ((virtFunc: [[Bf]], offset: 16), (virtFunc: [[An]], offset: 24)), refs: ([[Bf]], [[An]])
2828; NOENABLESPLITFLAG-DAG: [[C:\^[0-9]+]] = gv: (name: "_ZTV1C", {{.*}} vTableFuncs: ((virtFunc: [[Cf]], offset: 16), (virtFunc: [[An]], offset: 24)), refs: ([[An]], [[Cf]])
2929; NOENABLESPLITFLAG-DAG: [[D:\^[0-9]+]] = gv: (name: "_ZTV1D", {{.*}} vTableFuncs: ((virtFunc: [[Dm]], offset: 16)), refs: ([[Dm]])
30- ; NOENABLESPLITFLAG-DAG: [[B_RV:\^[0-9]+]] = gv: (name: "_ZTV1B_RV", {{.*}} vTableFuncs: ((virtFunc: [[Bf]], offset: 8), (virtFunc: [[An]], offset: 12)), refs: ([[B_RV]], [[Bf]], [[An]])
31- ; NOENABLESPLITFLAG-DAG: [[C_RV:\^[0-9]+]] = gv: (name: "_ZTV1C_RV", {{.*}} vTableFuncs: ((virtFunc: [[Cf]], offset: 8), (virtFunc: [[An]], offset: 12)), refs: ([[C_RV]], [[An]], [[Cf]])
32- ; NOENABLESPLITFLAG-DAG: [[D_RV:\^[0-9]+]] = gv: (name: "_ZTV1D_RV", {{.*}} vTableFuncs: ((virtFunc: [[Dm]], offset: 8)), refs: ([[D_RV]], [[Dm]])
3330; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1A", summary: ((offset: 16, [[B]]), (offset: 16, [[C]])))
3431; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1B", summary: ((offset: 16, [[B]])))
3532; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1C", summary: ((offset: 16, [[C]])))
36- ; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1A_RV", summary: ((offset: 8, [[B_RV]]), (offset: 8, [[C_RV]])))
37- ; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1B_RV", summary: ((offset: 8, [[B_RV]])))
38- ; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "_ZTS1C_RV", summary: ((offset: 8, [[C_RV]])))
3933; Type Id on _ZTV1D should have been promoted
4034; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "1.{{.*}}", summary: ((offset: 16, [[D]])))
41- ; NOENABLESPLITFLAG-DAG: typeidCompatibleVTable: (name: "2.{{.*}}", summary: ((offset: 8, [[D_RV]])))
4235
4336; Index based WPD
4437; RUN: llvm-lto2 run %t2.o -save-temps -pass-remarks=. \
4538; RUN: -whole-program-visibility \
4639; RUN: -o %t3 \
4740; RUN: -r=%t2.o,test,px \
48- ; RUN: -r=%t2.o,test_rv,px \
4941; RUN: -r=%t2.o,_ZN1A1nEi,p \
5042; RUN: -r=%t2.o,_ZN1B1fEi,p \
5143; RUN: -r=%t2.o,_ZN1C1fEi,p \
5244; RUN: -r=%t2.o,_ZN1D1mEi,p \
5345; RUN: -r=%t2.o,_ZTV1B,px \
5446; RUN: -r=%t2.o,_ZTV1C,px \
55- ; RUN: -r=%t2.o,_ZTV1D,px \
56- ; RUN: -r=%t2.o,_ZTV1B_RV,px \
57- ; RUN: -r=%t2.o,_ZTV1C_RV,px \
58- ; RUN: -r=%t2.o,_ZTV1D_RV,px \
59- ; RUN: 2>&1 | FileCheck %s --check-prefix=REMARK
47+ ; RUN: -r=%t2.o,_ZTV1D,px 2>&1 | FileCheck %s --check-prefix=REMARK
6048; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
6149
6250; Check that we're able to prevent specific function from being
6654; RUN: -wholeprogramdevirt-skip=_ZN1A1nEi \
6755; RUN: -o %t3 \
6856; RUN: -r=%t2.o,test,px \
69- ; RUN: -r=%t2.o,test_rv,px \
7057; RUN: -r=%t2.o,_ZN1A1nEi,p \
7158; RUN: -r=%t2.o,_ZN1B1fEi,p \
7259; RUN: -r=%t2.o,_ZN1C1fEi,p \
7360; RUN: -r=%t2.o,_ZN1D1mEi,p \
7461; RUN: -r=%t2.o,_ZTV1B,px \
7562; RUN: -r=%t2.o,_ZTV1C,px \
76- ; RUN: -r=%t2.o,_ZTV1D,px \
77- ; RUN: -r=%t2.o,_ZTV1B_RV,px \
78- ; RUN: -r=%t2.o,_ZTV1C_RV,px \
79- ; RUN: -r=%t2.o,_ZTV1D_RV,px \
80- ; RUN: 2>&1 | FileCheck %s --check-prefix=SKIP
63+ ; RUN: -r=%t2.o,_ZTV1D,px 2>&1 | FileCheck %s --check-prefix=SKIP
8164
8265; RUN: llvm-lto2 run %t.o -save-temps -pass-remarks=. \
8366; RUN: -whole-program-visibility \
8467; RUN: -o %t3 \
8568; RUN: -r=%t.o,test,px \
86- ; RUN: -r=%t.o,test_rv,px \
8769; RUN: -r=%t.o,_ZN1A1nEi,p \
8870; RUN: -r=%t.o,_ZN1B1fEi,p \
8971; RUN: -r=%t.o,_ZN1C1fEi,p \
9072; RUN: -r=%t.o,_ZN1D1mEi,p \
9173; RUN: -r=%t.o,_ZTV1B, \
9274; RUN: -r=%t.o,_ZTV1C, \
9375; RUN: -r=%t.o,_ZTV1D, \
94- ; RUN: -r=%t.o,_ZTV1B_RV, \
95- ; RUN: -r=%t.o,_ZTV1C_RV, \
96- ; RUN: -r=%t.o,_ZTV1D_RV, \
9776; RUN: -r=%t.o,_ZN1A1nEi, \
9877; RUN: -r=%t.o,_ZN1B1fEi, \
9978; RUN: -r=%t.o,_ZN1C1fEi, \
10079; RUN: -r=%t.o,_ZN1D1mEi, \
10180; RUN: -r=%t.o,_ZTV1B,px \
10281; RUN: -r=%t.o,_ZTV1C,px \
103- ; RUN: -r=%t.o,_ZTV1D,px \
104- ; RUN: -r=%t.o,_ZTV1B_RV,px \
105- ; RUN: -r=%t.o,_ZTV1C_RV,px \
106- ; RUN: -r=%t.o,_ZTV1D_RV,px \
107- ; RUN: 2>&1 | FileCheck %s --check-prefix=REMARK --dump-input=fail
82+ ; RUN: -r=%t.o,_ZTV1D,px 2>&1 | FileCheck %s --check-prefix=REMARK --dump-input=fail
10883; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
10984
110- ; REMARK-DAG: single-impl: devirtualized a call to _ZN1A1nEi
111- ; REMARK-DAG: single-impl: devirtualized a call to _ZN1D1mEi
11285; REMARK-DAG: single-impl: devirtualized a call to _ZN1A1nEi
11386; REMARK-DAG: single-impl: devirtualized a call to _ZN1D1mEi
11487
@@ -126,25 +99,6 @@ target triple = "x86_64-grtev4-linux-gnu"
12699@_ZTV1C = constant { [4 x ptr ] } { [4 x ptr ] [ptr null , ptr undef , ptr @_ZN1C1fEi , ptr @_ZN1A1nEi ] }, !type !0 , !type !2
127100@_ZTV1D = constant { [3 x ptr ] } { [3 x ptr ] [ptr null , ptr undef , ptr @_ZN1D1mEi ] }, !type !3
128101
129- @_ZTV1B_RV = constant { [4 x i32 ] } { [4 x i32 ] [
130- i32 0 ,
131- i32 undef ,
132- i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1B1fEi to i64 ), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32 ] }, ptr @_ZTV1B_RV , i32 0 , i32 0 , i32 2 ) to i64 )) to i32 ),
133- i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1A1nEi to i64 ), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32 ] }, ptr @_ZTV1B_RV , i32 0 , i32 0 , i32 3 ) to i64 )) to i32 )
134- ] }, !type !7 , !type !8
135-
136- @_ZTV1C_RV = constant { [4 x i32 ] } { [4 x i32 ] [
137- i32 0 ,
138- i32 undef ,
139- i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1C1fEi to i64 ), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32 ] }, ptr @_ZTV1C_RV , i32 0 , i32 0 , i32 2 ) to i64 )) to i32 ),
140- i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1A1nEi to i64 ), i64 ptrtoint (ptr getelementptr inbounds ({ [4 x i32 ] }, ptr @_ZTV1C_RV , i32 0 , i32 0 , i32 3 ) to i64 )) to i32 )
141- ] }, !type !7 , !type !9
142-
143- @_ZTV1D_RV = constant { [3 x i32 ] } { [3 x i32 ] [
144- i32 0 ,
145- i32 undef ,
146- i32 trunc (i64 sub (i64 ptrtoint (ptr dso_local_equivalent @_ZN1D1mEi to i64 ), i64 ptrtoint (ptr getelementptr inbounds ({ [3 x i32 ] }, ptr @_ZTV1D_RV , i32 0 , i32 0 , i32 2 ) to i64 )) to i32 )
147- ] }, !type !10
148102
149103; CHECK-IR-LABEL: define i32 @test
150104define i32 @test (ptr %obj , ptr %obj2 , i32 %a ) {
@@ -182,43 +136,6 @@ entry:
182136; CHECK-IR-LABEL: ret i32
183137; CHECK-IR-LABEL: }
184138
185- declare ptr @llvm.load.relative.i32 (ptr , i32 )
186-
187- ; CHECK-IR-LABEL: define i32 @test_rv
188- define i32 @test_rv (ptr %obj , ptr %obj2 , i32 %a ) {
189- entry:
190- %vtable = load ptr , ptr %obj
191- %p = call i1 @llvm.type.test (ptr %vtable , metadata !"_ZTS1A_RV" )
192- call void @llvm.assume (i1 %p )
193- %fptr1_rv = call ptr @llvm.load.relative.i32 (ptr %vtable , i32 4 )
194-
195- ; Check that the call was devirtualized.
196- ; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
197- ; Ensure !prof and !callees metadata for indirect call promotion removed.
198- ; CHECK-IR-NOT: prof
199- ; CHECK-IR-NOT: callees
200- %call = tail call i32 %fptr1_rv (ptr nonnull %obj , i32 %a ), !prof !5 , !callees !6
201-
202- %fptr22_rv = call ptr @llvm.load.relative.i32 (ptr %vtable , i32 0 )
203-
204- ; We still have to call it as virtual.
205- ; CHECK-IR: %call3 = tail call i32 %fptr22
206- %call3 = tail call i32 %fptr22_rv (ptr nonnull %obj , i32 %call )
207-
208- %vtable2 = load ptr , ptr %obj2
209- %p2 = call i1 @llvm.type.test (ptr %vtable2 , metadata !11 )
210- call void @llvm.assume (i1 %p2 )
211-
212- %fptr33_rv = call ptr @llvm.load.relative.i32 (ptr %vtable2 , i32 0 )
213-
214- ; Check that the call was devirtualized.
215- ; CHECK-IR: %call4 = tail call i32 @_ZN1D1mEi
216- %call4 = tail call i32 %fptr33_rv (ptr nonnull %obj2 , i32 %call3 )
217- ret i32 %call4
218- }
219- ; CHECK-IR-LABEL: ret i32
220- ; CHECK-IR-LABEL: }
221-
222139declare i1 @llvm.type.test (ptr , metadata )
223140declare void @llvm.assume (i1 )
224141
@@ -248,9 +165,3 @@ attributes #0 = { noinline optnone }
248165!4 = distinct !{}
249166!5 = !{!"VP" , i32 0 , i64 1 , i64 1621563287929432257 , i64 1 }
250167!6 = !{ptr @_ZN1A1nEi }
251-
252- !7 = !{i64 8 , !"_ZTS1A_RV" }
253- !8 = !{i64 8 , !"_ZTS1B_RV" }
254- !9 = !{i64 8 , !"_ZTS1C_RV" }
255- !10 = !{i64 8 , !11 }
256- !11 = distinct !{}
0 commit comments