Skip to content

Commit

Permalink
[CodeGen] Restrict addEmittedDeferredDecl to incremental extensions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hahnjo committed Aug 17, 2023
1 parent d066080 commit d43a3d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang/lib/CodeGen/CodeGenModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit d43a3d6

Please sign in to comment.