Skip to content

Commit

Permalink
Revert "[pgo] Avoid introducing relocations by using private alias"
Browse files Browse the repository at this point in the history
This reverts commit 2b8917f.

This breaks with lld and gold
  • Loading branch information
ilovepi committed Nov 16, 2022
1 parent 5c3ca10 commit 0cc8752
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
14 changes: 3 additions & 11 deletions llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
Expand Up @@ -1014,17 +1014,9 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfInstBase *Inc) {
};
auto *DataTy = StructType::get(Ctx, makeArrayRef(DataTypes));

Constant *FunctionAddr;
if (shouldRecordFunctionAddr(Fn)) {
// When possible use a private alias to avoid relocations
Constant *Addr = !Fn->isDeclarationForLinker()
? static_cast<Constant *>(GlobalAlias::create(
GlobalValue::PrivateLinkage, Fn->getName(), Fn))
: Fn;
FunctionAddr = ConstantExpr::getBitCast(Addr, Int8PtrTy);
} else {
FunctionAddr = ConstantPointerNull::get(Int8PtrTy);
}
Constant *FunctionAddr = shouldRecordFunctionAddr(Fn)
? ConstantExpr::getBitCast(Fn, Int8PtrTy)
: ConstantPointerNull::get(Int8PtrTy);

Constant *Int16ArrayVals[IPVK_Last + 1];
for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
Expand Down
23 changes: 0 additions & 23 deletions llvm/test/Transforms/PGOProfile/prof_avoid_relocs.ll

This file was deleted.

0 comments on commit 0cc8752

Please sign in to comment.