[llvm] [LiveDebugValues][nfc] Reduce memory usage of InstrRef (PR #76051)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 11:02:11 PST 2023
================
@@ -207,9 +207,48 @@ using namespace llvm;
/// Type for a table of values in a block.
using ValueTable = SmallVector<ValueIDNum, 0>;
-/// Type for a table-of-table-of-values, i.e., the collection of either
-/// live-in or live-out values for each block in the function.
-using FuncValueTable = SmallVector<ValueTable, 0>;
+/// A collection of ValueTables, one per BB in a function, with convenient
+/// accessor methods.
+struct FuncValueTable {
+ FuncValueTable(int NumBBs, int NumLocs) {
+ Storage.reserve(NumBBs);
+ for ([[maybe_unused]] auto _ : llvm::seq(NumBBs))
----------------
dwblaikie wrote:
I think this'd be better written as a:
```
for (int i = 0; i != NumBBs; ++i)
```
Creating a sequence, iterators, etc, and then discarding the value iterated over and having to add `[[maybe_unused]]` seems a bit too far into the weeds to me.
https://github.com/llvm/llvm-project/pull/76051
More information about the llvm-commits
mailing list