mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-20 19:04:10 -04:00
Revert "Add support for generating a call graph profile from Branch Frequency Info."
This reverts commits r335794 and r335797. Breaks ThinLTO+FDO selfhost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335851 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -91,12 +91,6 @@ static void GetObjCImageInfo(Module &M, unsigned &Version, unsigned &Flags,
|
||||
// ELF
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
|
||||
const TargetMachine &TgtM) {
|
||||
TargetLoweringObjectFile::Initialize(Ctx, TgtM);
|
||||
TM = &TgtM;
|
||||
}
|
||||
|
||||
void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
|
||||
Module &M) const {
|
||||
auto &C = getContext();
|
||||
@@ -122,49 +116,15 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
|
||||
StringRef Section;
|
||||
|
||||
GetObjCImageInfo(M, Version, Flags, Section);
|
||||
if (!Section.empty()) {
|
||||
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
|
||||
Streamer.SwitchSection(S);
|
||||
Streamer.EmitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
|
||||
Streamer.EmitIntValue(Version, 4);
|
||||
Streamer.EmitIntValue(Flags, 4);
|
||||
Streamer.AddBlankLine();
|
||||
}
|
||||
|
||||
SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
|
||||
M.getModuleFlagsMetadata(ModuleFlags);
|
||||
|
||||
MDNode *CFGProfile = nullptr;
|
||||
|
||||
for (const auto &MFE : ModuleFlags) {
|
||||
StringRef Key = MFE.Key->getString();
|
||||
if (Key == "CG Profile") {
|
||||
CFGProfile = cast<MDNode>(MFE.Val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CFGProfile)
|
||||
if (Section.empty())
|
||||
return;
|
||||
|
||||
auto GetSym = [this](const MDOperand &MDO) {
|
||||
auto V = cast<ValueAsMetadata>(MDO);
|
||||
const Function *F = cast<Function>(V->getValue());
|
||||
return TM->getSymbol(F);
|
||||
};
|
||||
|
||||
for (const auto &Edge : CFGProfile->operands()) {
|
||||
MDNode *E = cast<MDNode>(Edge);
|
||||
const MCSymbol *From = GetSym(E->getOperand(0));
|
||||
const MCSymbol *To = GetSym(E->getOperand(1));
|
||||
uint64_t Count = cast<ConstantAsMetadata>(E->getOperand(2))
|
||||
->getValue()
|
||||
->getUniqueInteger()
|
||||
.getZExtValue();
|
||||
Streamer.emitCGProfileEntry(
|
||||
MCSymbolRefExpr::create(From, MCSymbolRefExpr::VK_None, C),
|
||||
MCSymbolRefExpr::create(To, MCSymbolRefExpr::VK_None, C), Count);
|
||||
}
|
||||
auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
|
||||
Streamer.SwitchSection(S);
|
||||
Streamer.EmitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
|
||||
Streamer.EmitIntValue(Version, 4);
|
||||
Streamer.EmitIntValue(Flags, 4);
|
||||
Streamer.AddBlankLine();
|
||||
}
|
||||
|
||||
MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(
|
||||
|
||||
Reference in New Issue
Block a user