[PATCH] D71437: [PDB] Print the most redundant type record indices with /summary

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 16:13:13 PST 2020


rnk marked an inline comment as done.
rnk added inline comments.


================
Comment at: lld/COFF/PDB.cpp:431
+    // collecting statistics.
+    tpiCounts.resize(tMerger.getTypeTable().size());
+    ipiCounts.resize(tMerger.getIDTable().size());
----------------
MaskRay wrote:
> rnk wrote:
> > MaskRay wrote:
> > > Can `tpiCounts` be a non-empty vector before `resize()`?
> > > 
> > > If yes, `assign(tMerger.getTypeTable().size(), 0);`
> > Yes, it can be non-empty, but why is assign better? `resize()` does zero initialization, it is not reserve.
> If it was non-empty, existing non-zero values would not be zeroed.
> 
> ```
> If the current size is less than count,
> 
> 1) additional default-inserted elements are appended
> ```
> If it was non-empty, existing non-zero values would not be zeroed.

That is the intended behavior. I can't think of another good way to express this: grow the array, fill it with zeros, do it in a way that will trigger quadratic growth. Maybe a longer .insert call? `.insert(tpiCounts.end(), size, 0)`?

Well, I will commit it this way for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71437/new/

https://reviews.llvm.org/D71437





More information about the llvm-commits mailing list