[all-commits] [llvm/llvm-project] acacec: [LiveDebugValues][nfc] Reduce memory usage of Inst...

Felipe de Azevedo Piovezan via All-commits all-commits at lists.llvm.org
Sat Dec 23 08:44:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: acacec3bbf4586ef9bc6c4f31707d3515d5215a1
      https://github.com/llvm/llvm-project/commit/acacec3bbf4586ef9bc6c4f31707d3515d5215a1
  Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
  Date:   2023-12-23 (Sat, 23 Dec 2023)

  Changed paths:
    M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
    M llvm/unittests/CodeGen/InstrRefLDVTest.cpp

  Log Message:
  -----------
  [LiveDebugValues][nfc] Reduce memory usage of InstrRef (#76051)

Commit 1b531d54f623 (#74203) removed the usage of unique_ptrs of arrays
in favour of using vectors, but inadvertently increased peak memory
usage by removing the ability to deallocate vector memory that was no
longer needed mid-LDV.

In that same review, it was pointed out that `FuncValueTable` typedef
could be removed, since it was "just a vector".

This commit addresses both issues by making `FuncValueTable` a real data
structure, capable of mapping BBs to ValueTables and able to free
ValueTables as needed.

This reduces peak memory usage in the compiler by 10% in the benchmarks
flagged by the original review.

As a consequence, we had to remove a handful of instances of the
"declare-then-initialize" antipattern in unittests, as the
FuncValueTable class is no longer default-constructible.




More information about the All-commits mailing list