[NVPTX] Replace PTX's ManagedStringPool with StringSaver
authorLuke Drummond <luke.drummond@codeplay.com>
Tue, 20 Dec 2022 00:57:54 +0000 (00:57 +0000)
committerLuke Drummond <luke.drummond@codeplay.com>
Wed, 4 Jan 2023 11:28:39 +0000 (11:28 +0000)
commit6aa9cfb13f2599d69f93941f338134fbcc80a799
tree907a30048fa1b8cdcb83fd95110dd1206ba35eb0
parent72f3f6838fc4d3961868c6d7f6e08b9383cb2f8b
[NVPTX] Replace PTX's ManagedStringPool with StringSaver

In use ManagedStringPool caused a lot of heap allocations. At least one
for every register name lookup in NVPTXTargetRegisterInfo and one for
every symbol lookup in the target machine and isel lowering. There
already exists an llvm/Support string interning-class that has better
memory performance. Use LLVM's and delete ManagedStringPool which was
unique to PTX

llc Binary Size (.text only; bss and data were unchanged):
  MinsizeRel:
    Before: 31219884
    After: 31219796
  Release:
    Before: 42961872
    After: 42960656

Total heap allocations by the NVPTX string saving code running
check-llvm-codegen-nvptx

Total bytes allocated:
  Before: 2431825
  After: 2288151

(All numbers on x86-64-linux-gnu / gcc-12 / lld14)

I didn't see obvious time differences when running the tests.

Reviewers: tra, avasonic
Differential Revision: https://reviews.llvm.org/D140704
llvm/lib/Target/NVPTX/ManagedStringPool.h [deleted file]
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
llvm/lib/Target/NVPTX/NVPTXRegisterInfo.h
llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
llvm/lib/Target/NVPTX/NVPTXTargetMachine.h