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()))


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()))
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to