[llvm] [ctx_prof] CtxProfAnalysis: populate module data (PR #102930)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 13:34:57 PDT 2024


================
@@ -66,6 +66,36 @@ Value toJSON(const PGOCtxProfContext::CallTargetMapTy &P) {
 } // namespace json
 } // namespace llvm
 
+const char *AssignUniqueIDPass::GUIDMetadataName = "unique_id";
+
+PreservedAnalyses AssignUniqueIDPass::run(Module &M,
+                                          ModuleAnalysisManager &MAM) {
+  for (auto &F : M.functions()) {
+    if (F.isDeclaration())
+      continue;
+    if (F.getMetadata(GUIDMetadataName))
----------------
snehasish wrote:

Document the behaviour that we only assign a new guid if it does not exist?

https://github.com/llvm/llvm-project/pull/102930


More information about the llvm-commits mailing list