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

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 13:11:04 PDT 2024


================
@@ -57,9 +57,23 @@ class PGOCtxProfContext final {
 
   GlobalValue::GUID guid() const { return GUID; }
   const SmallVectorImpl<uint64_t> &counters() const { return Counters; }
+  SmallVectorImpl<uint64_t> &counters() { return Counters; }
+
+  uint64_t getEntrycount() const { return Counters[0]; }
+
   const CallsiteMapTy &callsites() const { return Callsites; }
   CallsiteMapTy &callsites() { return Callsites; }
 
+  void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) {
+    auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy());
+    Iter->second.emplace(Other.guid(), std::move(Other));
+  }
+
+  void growCounters(uint32_t Size) {
+    if (Size >= Counters.size())
----------------
snehasish wrote:

I think this check is redundant, i.e. the resize implementation does this already. Also perhaps call this `resizeCounters` to make it consistent.

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


More information about the llvm-commits mailing list