diff options
author | Teresa Johnson <tejohnson@google.com> | 2017-12-16 00:18:12 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2017-12-16 00:18:12 +0000 |
commit | 2140d926da5be829f23fc59bcaf8fe95800faed0 (patch) | |
tree | 20ac5e04344c3f76a1d630bf50e64926602bce3a /test/ThinLTO/X86/distributed_import.ll | |
parent | 2d82935d1ad3407029669a0854650f9aa7866150 (diff) |
[ThinLTO] Enable importing of aliases as copy of aliasee
Summary:
This implements a missing feature to allow importing of aliases, which
was previously disabled because alias cannot be available_externally.
We instead import an alias as a copy of its aliasee.
Some additional work was required in the IndexBitcodeWriter for the
distributed build case, to ensure that the aliasee has a value id
in the distributed index file (i.e. even when it is not being
imported directly).
This is a performance win in codes that have many aliases, e.g. C++
applications that have many constructor and destructor aliases.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D40747
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ThinLTO/X86/distributed_import.ll')
-rw-r--r-- | test/ThinLTO/X86/distributed_import.ll | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/test/ThinLTO/X86/distributed_import.ll b/test/ThinLTO/X86/distributed_import.ll index e7e4904d52b..365fbd9b0f7 100644 --- a/test/ThinLTO/X86/distributed_import.ll +++ b/test/ThinLTO/X86/distributed_import.ll @@ -10,11 +10,15 @@ ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ ; RUN: -thinlto-distributed-indexes \ ; RUN: -r=%t1.bc,g, \ +; RUN: -r=%t1.bc,analias, \ ; RUN: -r=%t1.bc,f,px \ -; RUN: -r=%t2.bc,g,px -; RUN: opt -function-import -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out -; RUN: opt -function-import -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out -; RUN: llvm-dis -o - %t2.out | FileCheck %s +; RUN: -r=%t2.bc,g,px \ +; RUN: -r=%t2.bc,analias,px \ +; RUN: -r=%t2.bc,aliasee,px +; RUN: opt -function-import -import-all-index -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out +; RUN: opt -function-import -import-all-index -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out +; RUN: llvm-dis -o - %t1.out | FileCheck %s --check-prefix=IMPORT +; RUN: llvm-dis -o - %t2.out | FileCheck %s --check-prefix=EXPORT ; Save the generated index files. ; RUN: cp %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig @@ -34,26 +38,35 @@ ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ ; RUN: -thinlto-distributed-indexes \ ; RUN: -r=%t1.bc,g, \ +; RUN: -r=%t1.bc,analias, \ ; RUN: -r=%t1.bc,f,px \ -; RUN: -r=%t2.bc,g,px +; RUN: -r=%t2.bc,g,px \ +; RUN: -r=%t2.bc,analias,px \ +; RUN: -r=%t2.bc,aliasee,px ; RUN: diff %t1.bc.thinlto.bc.orig %t1.bc.thinlto.bc ; RUN: diff %t2.bc.thinlto.bc.orig %t2.bc.thinlto.bc ; Make sure importing occurs as expected ; RUN: cp %t1.bc.sv %t1.bc ; RUN: cp %t2.bc.sv %t2.bc -; RUN: opt -function-import -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out -; RUN: llvm-dis -o - %t2.out | FileCheck %s +; RUN: opt -function-import -import-all-index -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out +; RUN: opt -function-import -import-all-index -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out +; RUN: llvm-dis -o - %t1.out | FileCheck %s --check-prefix=IMPORT +; RUN: llvm-dis -o - %t2.out | FileCheck %s --check-prefix=EXPORT -; CHECK: @G.llvm. +; IMPORT: define available_externally i32 @g() !thinlto_src_module +; IMPORT: define available_externally void @analias() !thinlto_src_module +; EXPORT: @G.llvm. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" declare i32 @g(...) +declare void @analias(...) define void @f() { entry: call i32 (...) @g() + call void (...) @analias() ret void } |