[clang] d43a3d6 - [CodeGen] Restrict addEmittedDeferredDecl to incremental extensions

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 02:54:59 PDT 2023


Author: Jonas Hahnfeld
Date: 2023-08-17T11:54:05+02:00
New Revision: d43a3d6346961e639e29b8083b262416889e78ec

URL: https://github.com/llvm/llvm-project/commit/d43a3d6346961e639e29b8083b262416889e78ec
DIFF: https://github.com/llvm/llvm-project/commit/d43a3d6346961e639e29b8083b262416889e78ec.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

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 7301109fb04409..c22dd8486270a0 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 cfe-commits mailing list