[llvm-branch-commits] [compiler-rt] [llvm] [ctxprof] Track unhandled call targets (PR #131417)

Mircea Trofin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 17 22:05:51 PDT 2025


================
@@ -265,7 +275,16 @@ Error llvm::createCtxProfFromYAML(StringRef Profile, raw_ostream &Out) {
       if (!TopList)
         return createStringError(
             "Unexpected error converting internal structure to ctx profile");
-      Writer.writeContextual(*TopList, DC.TotalRootEntryCount);
+
+      ctx_profile::ContextNode *FirstUnhandled = nullptr;
+      for (const auto &U : DC.Unhandled) {
+        SerializableCtxRepresentation Unhandled;
+        Unhandled.Guid = U.first;
+        Unhandled.Counters.insert(Unhandled.Counters.begin(), U.second.begin(),
----------------
mtrofin wrote:

wdym. this copies the counter values from `U.second` to `Unhandled`. `insert` with a first/last iterator pair will - afaik - allocate the diff (last - first) (caveats about difference being computable, but the source is also a vector). Also why would I reverse?

There *is* a more efficient alternative - having a `createNode` that takes the guid and the counters separately - but not quite worth it for the yaml converter, it's a test utility.

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


More information about the llvm-branch-commits mailing list