[NFC][CodeGen] Use llvm::DenseMap for DeferredDecls
authorDawid Jurczak <dawid_jurek@vp.pl>
Tue, 25 Jan 2022 15:53:05 +0000 (16:53 +0100)
committerDawid Jurczak <dawid_jurek@vp.pl>
Thu, 27 Jan 2022 09:57:48 +0000 (10:57 +0100)
commitb88ca619d33bc74e1776d879e43c6fc812ac4ff5
tree91a0e03c6ced8204976452c194a2e30eeb25c37e
parentbb5c1b06916b3452a2717867428077a3c119275f
[NFC][CodeGen] Use llvm::DenseMap for DeferredDecls

CodeGenModule::DeferredDecls std::map::operator[] seem to be hot especially while code generating huge compilation units.
In such cases using DenseMap instead gives observable compile time improvement. Patch was tested on Linux build with default config acting as benchmark.
Build was performed on isolated CPU cores in silent x86-64 Linux environment following: https://llvm.org/docs/Benchmarking.html#linux rules.
Compile time statistics diff produced by perf and time before and after change are following:
instructions -0.15%, cycles -0.7%, max-rss +0.65%.
Using StringMap instead DenseMap doesn't bring any visible gains.

Differential Revision: https://reviews.llvm.org/D118169
clang/lib/CodeGen/CodeGenModule.h