Author: Dawid Jurczak Date: 2022-01-27T10:57:48+01:00 New Revision: b88ca619d33bc74e1776d879e43c6fc812ac4ff5
URL: https://github.com/llvm/llvm-project/commit/b88ca619d33bc74e1776d879e43c6fc812ac4ff5 DIFF: https://github.com/llvm/llvm-project/commit/b88ca619d33bc74e1776d879e43c6fc812ac4ff5.diff LOG: [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 Added: Modified: clang/lib/CodeGen/CodeGenModule.h Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 9ae9d624b925d..e803022508a4c 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -335,7 +335,7 @@ class CodeGenModule : public CodeGenTypeCache { /// for emission and therefore should only be output if they are actually /// used. If a decl is in this, then it is known to have not been referenced /// yet. - std::map<StringRef, GlobalDecl> DeferredDecls; + llvm::DenseMap<StringRef, GlobalDecl> DeferredDecls; /// This is a list of deferred decls which we have seen that *are* actually /// referenced. These get code generated when the module is done. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits