[PATCH] D73529: [Instrumentation] Set hidden visibility for the bias variable
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 23:38:36 PST 2020
phosek created this revision.
phosek added reviewers: vsk, davidxl, mcgrathr.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
We have to avoid using a GOT relocation to access the bias variable,
setting the hidden visibility achieves that.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73529
Files:
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -686,10 +686,12 @@
IRBuilder<> Builder(&I);
Type *Int64Ty = Type::getInt64Ty(M->getContext());
GlobalVariable *Bias = M->getGlobalVariable(getInstrProfCounterBiasVarName());
- if (!Bias)
+ if (!Bias) {
Bias = new GlobalVariable(*M, Int64Ty, false, GlobalValue::LinkOnceODRLinkage,
Constant::getNullValue(Int64Ty),
getInstrProfCounterBiasVarName());
+ Bias->setVisibility(GlobalVariable::HiddenVisibility);
+ }
LI = Builder.CreateLoad(Int64Ty, Bias);
}
auto *Add = Builder.CreateAdd(Builder.CreatePtrToInt(Addr, Int64Ty), LI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73529.240781.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200128/7947e102/attachment.bin>
More information about the llvm-commits
mailing list