1 ; Check that we import and inline virtual method with single implementation
2 ; when we're running hybrid LTO.
4 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit %s -o %t-main.bc
5 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit %p/Inputs/devirt_single_hybrid_foo.ll -o %t-foo.bc
6 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit %p/Inputs/devirt_single_hybrid_bar.ll -o %t-bar.bc
7 ; RUN: llvm-lto2 run -save-temps %t-main.bc %t-foo.bc %t-bar.bc -pass-remarks=. -o %t \
8 ; RUN: -r=%t-foo.bc,_Z3fooP1A,pl \
9 ; RUN: -r=%t-main.bc,main,plx \
10 ; RUN: -r=%t-main.bc,_Z3barv,l \
11 ; RUN: -r=%t-bar.bc,_Z3barv,pl \
12 ; RUN: -r=%t-bar.bc,_Z3fooP1A, \
13 ; RUN: -r=%t-bar.bc,_ZNK1A1fEv,pl \
14 ; RUN: -r=%t-bar.bc,_ZTV1A,l \
15 ; RUN: -r=%t-bar.bc,_ZTVN10__cxxabiv117__class_type_infoE, \
16 ; RUN: -r=%t-bar.bc,_ZTS1A,pl \
17 ; RUN: -r=%t-bar.bc,_ZTI1A,pl \
18 ; RUN: -r=%t-bar.bc,_ZNK1A1fEv, \
19 ; RUN: -r=%t-bar.bc,_ZTV1A,pl \
20 ; RUN: -r=%t-bar.bc,_ZTI1A, 2>&1 | FileCheck %s --check-prefix=REMARK
21 ; RUN: llvm-dis %t.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT
22 ; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN
24 ; REMARK-COUNT-3: single-impl: devirtualized a call to _ZNK1A1fEv
26 ; IMPORT: define available_externally hidden i32 @_ZNK1A1fEv(%struct.A* %this)
28 ; IMPORT-NEXT: ret i32 3
30 ; CODEGEN: define hidden i32 @main()
31 ; CODEGEN-NEXT: entry:
32 ; CODEGEN-NEXT: ret i32 23
34 ; Virtual method should have been optimized out
35 ; CODEGEN-NOT: _ZNK1A1fEv
37 ; ModuleID = 'main.cpp'
38 source_filename = "main.cpp"
39 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
40 target triple = "x86_64-unknown-linux-gnu"
42 ; Function Attrs: norecurse uwtable
43 define hidden i32 @main() local_unnamed_addr {
45 %call = tail call i32 @_Z3barv()
49 declare dso_local i32 @_Z3barv() local_unnamed_addr
51 !llvm.module.flags = !{!0}
54 !0 = !{i32 1, !"wchar_size", i32 4}
55 !1 = !{!"clang version 10.0.0 (trunk 373596)"}