diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-03-27 15:27:30 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-03-27 15:27:30 +0000 |
commit | d29478f70ed60a34e5737c4f48be638ef35f3c41 (patch) | |
tree | 6acde4398a57f947b921fdcaef7d97fd02a7917f /llvm/test/Transforms/FunctionImport | |
parent | 9aae395fa809aa07dcceafc2552cca45205c43bd (diff) | |
download | bcm5719-llvm-d29478f70ed60a34e5737c4f48be638ef35f3c41.tar.gz bcm5719-llvm-d29478f70ed60a34e5737c4f48be638ef35f3c41.zip |
[ThinLTO] Add optional import message and statistics
Summary:
Add a statistic to count the number of imported functions. Also, add a
new -print-imports option to emit a trace of imported functions, that
works even for an NDEBUG build.
Note that emitOptimizationRemark does not work for the above printing as
it expects a Function object and DebugLoc, neither of which we have
with summary-based importing.
This is part 2 of D18487, the first part was committed separately as
r264536.
Reviewers: joker.eph
Subscribers: llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D18487
llvm-svn: 264537
Diffstat (limited to 'llvm/test/Transforms/FunctionImport')
-rw-r--r-- | llvm/test/Transforms/FunctionImport/funcimport.ll | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/test/Transforms/FunctionImport/funcimport.ll b/llvm/test/Transforms/FunctionImport/funcimport.ll index f18ed942e16..e477db50977 100644 --- a/llvm/test/Transforms/FunctionImport/funcimport.ll +++ b/llvm/test/Transforms/FunctionImport/funcimport.ll @@ -4,7 +4,7 @@ ; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc ; Do the import now -; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF +; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF ; Test import with smaller instruction limit ; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=5 -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIM5 @@ -34,9 +34,12 @@ declare void @analias(...) #1 ; Aliases import the aliasee function declare void @linkoncealias(...) #1 +; INSTLIMDEF-DAG: Import linkoncealias +; INSTLIMDEF-DAG: Import linkoncefunc ; CHECK-DAG: define linkonce_odr void @linkoncefunc() ; CHECK-DAG: @linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)* +; INSTLIMDEF-DAG: Import referencestatics ; INSTLIMDEF-DAG: define available_externally i32 @referencestatics(i32 %i) ; INSTLIM5-DAG: declare i32 @referencestatics(...) declare i32 @referencestatics(...) #1 @@ -44,22 +47,28 @@ declare i32 @referencestatics(...) #1 ; The import of referencestatics will expose call to staticfunc that ; should in turn be imported as a promoted/renamed and hidden function. ; Ensure that the call is to the properly-renamed function. +; INSTLIMDEF-DAG: Import staticfunc ; INSTLIMDEF-DAG: %call = call i32 @staticfunc.llvm.2() ; INSTLIMDEF-DAG: define available_externally hidden i32 @staticfunc.llvm.2() +; INSTLIMDEF-DAG: Import referenceglobals ; CHECK-DAG: define available_externally i32 @referenceglobals(i32 %i) declare i32 @referenceglobals(...) #1 ; The import of referenceglobals will expose call to globalfunc1 that ; should in turn be imported. +; INSTLIMDEF-DAG: Import globalfunc1 ; CHECK-DAG: define available_externally void @globalfunc1() +; INSTLIMDEF-DAG: Import referencecommon ; CHECK-DAG: define available_externally i32 @referencecommon(i32 %i) declare i32 @referencecommon(...) #1 +; INSTLIMDEF-DAG: Import setfuncptr ; CHECK-DAG: define available_externally void @setfuncptr() declare void @setfuncptr(...) #1 +; INSTLIMDEF-DAG: Import callfuncptr ; CHECK-DAG: define available_externally void @callfuncptr() declare void @callfuncptr(...) #1 @@ -73,5 +82,9 @@ declare void @callfuncptr(...) #1 ; CHECK-DAG: declare void @weakfunc(...) declare void @weakfunc(...) #1 +; INSTLIMDEF-DAG: Import funcwithpersonality ; INSTLIMDEF-DAG: define available_externally hidden void @funcwithpersonality.llvm.2() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { ; INSTLIM5-DAG: declare hidden void @funcwithpersonality.llvm.2() + +; INSTLIMDEF-DAG: Import globalfunc2 +; INSTLIMDEF: 11 function-import - Number of functions imported |