[PATCH] D48105: [llvm][Instrumentation] Add Call Graph Profile pass
Saleem Abdulrasool via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 13 13:33:25 PDT 2018
compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.
I assume that there is/will be a different change to the frontend to enable this for users?
================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:146
+ MDNode *E = cast<MDNode>(Edge);
+ const MCSymbol *From = Streamer.getContext().getOrCreateSymbol(
+ cast<MDString>(E->getOperand(0))->getString());
----------------
Probably would be nice to hoist the `Streamer.getContext()` out of the loop.
auto &C = Streamer.getContext();
================
Comment at: lib/Transforms/Instrumentation/CGProfile.cpp:75-88
+ LLVMContext &Context = M.getContext();
+ MDBuilder MDB(Context);
+ std::vector<Metadata *> Nodes;
+
+ for (auto E : Counts) {
+ SmallVector<Metadata *, 3> Vals;
+ Vals.push_back(MDB.createString(E.first.first));
----------------
Would be nice to move this (L75-88) into a helper function (`UpdateModuleMetadata`?)
https://reviews.llvm.org/D48105
More information about the llvm-commits
mailing list