[llvm-branch-commits] [llvm] [ctx_prof] Add support for ICP (PR #105469)

Mircea Trofin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 27 15:37:19 PDT 2024


================
@@ -456,3 +463,170 @@ declare void @_ZN5Base35func3Ev(ptr)
   // 1 call instruction from the entry block.
   EXPECT_EQ(F->front().size(), OrigEntryBBSize + 4);
 }
+
+using namespace llvm::ctx_profile;
+
+class ContextManager final {
+  std::vector<std::unique_ptr<char[]>> Nodes;
+  std::map<GUID, const ContextNode *> Roots;
+
+public:
+  ContextNode *createNode(GUID Guid, uint32_t NrCounters, uint32_t NrCallsites,
+                          ContextNode *Next = nullptr) {
+    auto AllocSize = ContextNode::getAllocSize(NrCounters, NrCallsites);
+    auto *Mem = Nodes.emplace_back(std::make_unique<char[]>(AllocSize)).get();
+    std::memset(Mem, 0, AllocSize);
----------------
mtrofin wrote:

I actually don't need this whole thing.

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


More information about the llvm-branch-commits mailing list