[PATCH] D34838: Prototype: Reduce llvm-profdata merge memory usage further

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 15:05:32 PDT 2017


dblaikie created this revision.
Herald added a subscriber: eraman.

The InstrProfWriter already stores the name and hash of the record in
the nested maps it uses for lookup while merging - this data is
duplicated in the value within the maps.

Refactor the InstrProfRecord to use a nested struct for the counters
themselves so that InstrProfWriter can use this nested struct alone
without the name or hash duplicated there.

This work is incomplete, but enough to demonstrate the value (around a
50% decrease in memory usage for a large test case (10GB -> 5GB)).
Though most of that decrease is probably from removing the
SoftInstrProfError as well, but I haven't implemented a replacement for
it yet. (it needs to go with the counters, because the operations on the
counters - merging, etc, are where the failures are - unlike the
name/hash which are totally unused by those counter-related operations
and thus easy to split out)

Ongoing discussion about removing SoftInstrProfError as a field of the
InstrProfRecord is happening on the thread that added it - including
the possibility of moving back towards an earlier version of that
proposed patch that passed SoftInstrProfError through the various APIs,
rather than as a member of InstrProfRecord.


https://reviews.llvm.org/D34838

Files:
  include/llvm/ProfileData/InstrProf.h
  include/llvm/ProfileData/InstrProfData.inc
  include/llvm/ProfileData/InstrProfReader.h
  include/llvm/ProfileData/InstrProfWriter.h
  lib/ProfileData/InstrProf.cpp
  lib/ProfileData/InstrProfReader.cpp
  lib/ProfileData/InstrProfWriter.cpp
  lib/ProfileData/ProfileSummaryBuilder.cpp
  tools/llvm-profdata/llvm-profdata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34838.104748.patch
Type: text/x-patch
Size: 47608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/e4a98d2f/attachment-0001.bin>


More information about the llvm-commits mailing list