summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-10-29 04:08:31 +0000
committerXinliang David Li <davidxl@google.com>2015-10-29 04:08:31 +0000
commit7a88ad647636cb9580787db5f6e7e3b8f155127c (patch)
treee194f0aa35f9a8e4828bc6297b74069fba0dead4 /llvm/lib
parentd7968879615d9ddca8453c4c45406014747e5a3b (diff)
downloadbcm5719-llvm-7a88ad647636cb9580787db5f6e7e3b8f155127c.tar.gz
bcm5719-llvm-7a88ad647636cb9580787db5f6e7e3b8f155127c.zip
[PGO] Do not emit runtime hook user function for Linux
Clang driver now injects -u<hook_var> flag in the linker command line, in which case user function is not needed any more. Differential Revision: http://reviews.llvm.org/D14033 llvm-svn: 251612
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 55fd86f7172..493c70e8fd6 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -288,6 +288,11 @@ void InstrProfiling::emitRegistration() {
void InstrProfiling::emitRuntimeHook() {
+ // We expect the linker to be invoked with -u<hook_var> flag for linux,
+ // for which case there is no need to emit the user function.
+ if (Triple(M->getTargetTriple()).isOSLinux())
+ return;
+
// If the module's provided its own runtime, we don't need to do anything.
if (M->getGlobalVariable(getInstrProfRuntimeHookVarName())) return;
OpenPOWER on IntegriCloud