[llvm-branch-commits] [clang] 0a3a919 - [CodeGen] Restrict addEmittedDeferredDecl to incremental extensions
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 21 01:08:35 PDT 2023
Author: Jonas Hahnfeld
Date: 2023-08-21T10:05:22+02:00
New Revision: 0a3a9197247edbd33803a3691efa513ac228860f
URL: https://github.com/llvm/llvm-project/commit/0a3a9197247edbd33803a3691efa513ac228860f
DIFF: https://github.com/llvm/llvm-project/commit/0a3a9197247edbd33803a3691efa513ac228860f.diff
LOG: [CodeGen] Restrict addEmittedDeferredDecl to incremental extensions
Reemission is only needed in incremental mode. With this early return,
we avoid overhead from addEmittedDeferredDecl in non-incremental mode.
Differential Revision: https://reviews.llvm.org/D157379
(cherry picked from commit d43a3d6346961e639e29b8083b262416889e78ec)
Added:
Modified:
clang/lib/CodeGen/CodeGenModule.h
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 96b3977a19adb0..dd97808c7775c3 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -361,6 +361,10 @@ class CodeGenModule : public CodeGenTypeCache {
llvm::DenseMap<llvm::StringRef, GlobalDecl> EmittedDeferredDecls;
void addEmittedDeferredDecl(GlobalDecl GD) {
+ // Reemission is only needed in incremental mode.
+ if (!Context.getLangOpts().IncrementalExtensions)
+ return;
+
// Assume a linkage by default that does not need reemission.
auto L = llvm::GlobalValue::ExternalLinkage;
if (llvm::isa<FunctionDecl>(GD.getDecl()))
More information about the llvm-branch-commits
mailing list