1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[Instrumentation] Set hidden visibility for the bias variable

We have to avoid using a GOT relocation to access the bias variable,
setting the hidden visibility achieves that.

Differential Revision: https://reviews.llvm.org/D73529
This commit is contained in:
Petr Hosek 2020-01-27 23:28:03 -08:00
parent a8f8095d01
commit c390195246
2 changed files with 4 additions and 2 deletions

View File

@ -686,10 +686,12 @@ void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) {
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);

View File

@ -4,7 +4,7 @@
target triple = "x86_64-unknown-linux-gnu"
@__profn_foo = hidden constant [3 x i8] c"foo"
; RELOC: @__llvm_profile_counter_bias = linkonce_odr global i64 0
; RELOC: @__llvm_profile_counter_bias = linkonce_odr hidden global i64 0
; CHECK-LABEL: define void @foo
; CHECK-NEXT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0)