aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp38
1 files changed, 1 insertions, 37 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp
index e8636052c54c..35a830f416f6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp
@@ -20,31 +20,6 @@
using namespace llvm;
-#define DEBUG_TYPE "pseudoprobe"
-
-PseudoProbeHandler::~PseudoProbeHandler() = default;
-
-PseudoProbeHandler::PseudoProbeHandler(AsmPrinter *A, Module *M) : Asm(A) {
- NamedMDNode *FuncInfo = M->getNamedMetadata(PseudoProbeDescMetadataName);
- assert(FuncInfo && "Pseudo probe descriptors are missing");
- for (const auto *Operand : FuncInfo->operands()) {
- const auto *MD = cast<MDNode>(Operand);
- auto GUID =
- mdconst::dyn_extract<ConstantInt>(MD->getOperand(0))->getZExtValue();
- auto Name = cast<MDString>(MD->getOperand(2))->getString();
- // We may see pairs with same name but different GUIDs here in LTO mode, due
- // to static same-named functions inlined from other modules into this
- // module. Function profiles with the same name will be merged no matter
- // whether they are collected on the same function. Therefore we just pick
- // up the last <Name, GUID> pair here to represent the same-named function
- // collection and all probes from the collection will be merged into a
- // single profile eventually.
- Names[Name] = GUID;
- }
-
- LLVM_DEBUG(dump());
-}
-
void PseudoProbeHandler::emitPseudoProbe(uint64_t Guid, uint64_t Index,
uint64_t Type, uint64_t Attr,
const DILocation *DebugLoc) {
@@ -60,8 +35,7 @@ void PseudoProbeHandler::emitPseudoProbe(uint64_t Guid, uint64_t Index,
auto Name = SP->getLinkageName();
if (Name.empty())
Name = SP->getName();
- assert(Names.count(Name) && "Pseudo probe descriptor missing for function");
- uint64_t CallerGuid = Names[Name];
+ uint64_t CallerGuid = Function::getGUID(Name);
uint64_t CallerProbeId = PseudoProbeDwarfDiscriminator::extractProbeIndex(
InlinedAt->getDiscriminator());
ReversedInlineStack.emplace_back(CallerGuid, CallerProbeId);
@@ -72,13 +46,3 @@ void PseudoProbeHandler::emitPseudoProbe(uint64_t Guid, uint64_t Index,
ReversedInlineStack.rend());
Asm->OutStreamer->emitPseudoProbe(Guid, Index, Type, Attr, InlineStack);
}
-
-#ifndef NDEBUG
-void PseudoProbeHandler::dump() const {
- dbgs() << "\n=============================\n";
- dbgs() << "\nFunction Name to GUID map:\n";
- dbgs() << "\n=============================\n";
- for (const auto &Item : Names)
- dbgs() << "Func: " << Item.first << " GUID: " << Item.second << "\n";
-}
-#endif