diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-08-18 00:59:24 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-08-18 00:59:24 +0000 |
commit | dcd27e4c3cf88ba68b4e7b6ab9f2196f03d0d5a6 (patch) | |
tree | 847678ff92c7fd90c5dbd79a79018dd54b75bf4c | |
parent | 76e81b28c66f8f05e8bdf531495552338e8bfcac (diff) |
[LTO] Promote before performing weak resolution
Summary:
This was reversed compared to ThinLTOCodeGenerator for some reason,
and lead to an increased code-size on my tests. I figured that the
weak resolution may internalize a linkonce function, which will be
promoted immediately (and renamed), before being internalized again.
Reviewers: tejohnson
Subscribers: pcc, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D23632
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279021 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/LTO/LTOBackend.cpp | 4 | ||||
-rw-r--r-- | test/ThinLTO/X86/internalize.ll | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp index ddd0a6d8e58..935152b970d 100644 --- a/lib/LTO/LTOBackend.cpp +++ b/lib/LTO/LTOBackend.cpp @@ -250,10 +250,10 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddOutputFn AddOutput, if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(Task, Mod)) return Error(); - thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals); - renameModuleForThinLTO(Mod, CombinedIndex); + thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals); + if (Conf.PostPromoteModuleHook && !Conf.PostPromoteModuleHook(Task, Mod)) return Error(); diff --git a/test/ThinLTO/X86/internalize.ll b/test/ThinLTO/X86/internalize.ll index 4991df55820..dbd768d35c7 100644 --- a/test/ThinLTO/X86/internalize.ll +++ b/test/ThinLTO/X86/internalize.ll @@ -3,10 +3,19 @@ ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=REGULAR ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc -o - --exported-symbol=foo | llvm-dis -o - | FileCheck %s --check-prefix=INTERNALIZE +; RUN: llvm-lto2 %t1.bc -o %t.o -save-temps \ +; RUN: -r=%t1.bc,_foo,pxl \ +; RUN: -r=%t1.bc,_bar,pl \ +; RUN: -r=%t1.bc,_linkonce_func,pl +; RUN: llvm-dis < %t.o.1.2.internalize.bc | FileCheck %s --check-prefix=INTERNALIZE + + ; REGULAR: define void @foo ; REGULAR: define void @bar +; REGULAR: define linkonce void @linkonce_func() ; INTERNALIZE: define void @foo ; INTERNALIZE: define internal void @bar +; INTERNALIZE: define internal void @linkonce_func() target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.11.0" @@ -15,5 +24,9 @@ define void @foo() { ret void } define void @bar() { + call void @linkonce_func() + ret void +} +define linkonce void @linkonce_func() { ret void }
\ No newline at end of file |