[PATCH] D157379: [CodeGen] Restrict addEmittedDeferredDecl to incremental extensions

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 8 02:29:56 PDT 2023


Hahnfeld created this revision.
Hahnfeld added reviewers: rjmccall, v.g.vassilev, junaire.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Reemission is only needed in incremental mode. With this early return,
we avoid overhead from `addEmittedDeferredDecl` in non-incremental mode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157379

Files:
  clang/lib/CodeGen/CodeGenModule.h


Index: clang/lib/CodeGen/CodeGenModule.h
===================================================================
--- clang/lib/CodeGen/CodeGenModule.h
+++ clang/lib/CodeGen/CodeGenModule.h
@@ -361,6 +361,10 @@
   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()))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157379.548121.patch
Type: text/x-patch
Size: 617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230808/c44f36ba/attachment.bin>


More information about the cfe-commits mailing list