[PATCH] D49560: Add support to track total counts for DebugCounter

Zhizhou Yang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 13:39:23 PDT 2018


zhizhouy added inline comments.


================
Comment at: include/llvm/Support/DebugCounter.h:162
+  };
+  DenseMap<unsigned, CounterInfo> Counters;
   DenseMap<unsigned, std::string> CounterDesc;
----------------
george.burgess.iv wrote:
> I don't know the history of this code, but it seems reasonable to me to make this a `vector`, add a `string Desc` to `CounterInfo`, and drop `CounterDesc` entirely. `CounterVector` just returns `[1..UINT_MAX]`, in order, on insertion anyway.
> 
> (Alternatively, it seems that we could replace all three of these containers with a single `StringMap<CounterInfo>` and hand `CounterInfo *`s out instead of `unsigned`s, but that starts to stray pretty far from the goal of this patch, so... :) )
I have moved Desc into the CounterInfo struct. Using vector to replace DenseMap may cause some ambiguity from UniqueVector on index. So I am keeping the DenseMap for now. We may come up with another patch to do the second change you mentioned.


Repository:
  rL LLVM

https://reviews.llvm.org/D49560





More information about the llvm-commits mailing list