81 lines · plain
1; Check that we import and inline virtual method with single implementation2; when we're running hybrid LTO.3;4; RUN: opt -thinlto-bc -thinlto-split-lto-unit %s -o %t-main.bc5; RUN: opt -thinlto-bc -thinlto-split-lto-unit %p/Inputs/devirt_single_hybrid_bar.ll -o %t-bar.bc6 7; Test the assume(type.test) case.8 9; RUN: opt -thinlto-bc -thinlto-split-lto-unit %p/Inputs/devirt_single_hybrid_foo.ll -o %t-foo.bc10; RUN: llvm-lto2 run -save-temps %t-main.bc %t-foo.bc %t-bar.bc -pass-remarks=. -o %t \11; RUN: -whole-program-visibility \12; RUN: -r=%t-foo.bc,_Z3fooP1A,pl \13; RUN: -r=%t-main.bc,main,plx \14; RUN: -r=%t-main.bc,_Z3barv,l \15; RUN: -r=%t-bar.bc,_Z3barv,pl \16; RUN: -r=%t-bar.bc,_Z3fooP1A, \17; RUN: -r=%t-bar.bc,_ZNK1A1fEv,pl \18; RUN: -r=%t-bar.bc,_ZTV1A,l \19; RUN: -r=%t-bar.bc,_ZTVN10__cxxabiv117__class_type_infoE, \20; RUN: -r=%t-bar.bc,_ZTS1A,pl \21; RUN: -r=%t-bar.bc,_ZTI1A,pl \22; RUN: -r=%t-bar.bc,_ZNK1A1fEv, \23; RUN: -r=%t-bar.bc,_ZTV1A,pl \24; RUN: -r=%t-bar.bc,_ZTI1A, 2>&1 | FileCheck %s --check-prefix=REMARK25; RUN: llvm-dis %t.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT26; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN27 28; Test the type.checked.load case.29 30; RUN: opt -thinlto-bc -thinlto-split-lto-unit %p/Inputs/devirt_single_hybrid_foo_tcl.ll -o %t-foo.bc31; RUN: llvm-lto2 run -save-temps %t-main.bc %t-foo.bc %t-bar.bc -pass-remarks=. -o %t \32; RUN: -whole-program-visibility \33; RUN: -r=%t-foo.bc,_Z3fooP1A,pl \34; RUN: -r=%t-main.bc,main,plx \35; RUN: -r=%t-main.bc,_Z3barv,l \36; RUN: -r=%t-bar.bc,_Z3barv,pl \37; RUN: -r=%t-bar.bc,_Z3fooP1A, \38; RUN: -r=%t-bar.bc,_ZNK1A1fEv,pl \39; RUN: -r=%t-bar.bc,_ZTV1A,l \40; RUN: -r=%t-bar.bc,_ZTVN10__cxxabiv117__class_type_infoE, \41; RUN: -r=%t-bar.bc,_ZTS1A,pl \42; RUN: -r=%t-bar.bc,_ZTI1A,pl \43; RUN: -r=%t-bar.bc,_ZNK1A1fEv, \44; RUN: -r=%t-bar.bc,_ZTV1A,pl \45; RUN: -r=%t-bar.bc,_ZTI1A, 2>&1 | FileCheck %s --check-prefix=REMARK46; RUN: llvm-dis %t.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT47; RUN: llvm-dis %t.1.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN48 49; REMARK-COUNT-3: single-impl: devirtualized a call to _ZNK1A1fEv50 51; IMPORT: define available_externally hidden {{(noundef )?}}i32 @_ZNK1A1fEv(ptr %this)52; IMPORT-NEXT: entry:53; IMPORT-NEXT: ret i32 354 55; CODEGEN: define hidden {{(noundef )?}}i32 @main()56; CODEGEN-NEXT: entry:57; CODEGEN-NEXT: ret i32 2358 59; Virtual method should have been optimized out60; CODEGEN-NOT: _ZNK1A1fEv61 62; ModuleID = 'main.cpp'63source_filename = "main.cpp"64target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"65target triple = "x86_64-unknown-linux-gnu"66 67; Function Attrs: norecurse uwtable68define hidden i32 @main() local_unnamed_addr {69entry:70 %call = tail call i32 @_Z3barv()71 ret i32 %call72}73 74declare dso_local i32 @_Z3barv() local_unnamed_addr75 76!llvm.module.flags = !{!0}77!llvm.ident = !{!1}78 79!0 = !{i32 1, !"wchar_size", i32 4}80!1 = !{!"clang version 10.0.0 (trunk 373596)"}81