[PATCH] D113651: [DebugInfo] DwarfCompileUnit: Check for existing global vars after getting a context

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 00:38:41 PST 2021


krisb created this revision.
krisb added a reviewer: dblaikie.
Herald added a subscriber: hiraditya.
krisb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

It doesn't seem to change something but makes the code and the comments agreed. NFCI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113651

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp


Index: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -134,10 +134,6 @@
 
 DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
     const DIGlobalVariable *GV, ArrayRef<GlobalExpr> GlobalExprs) {
-  // Check for pre-existence.
-  if (DIE *Die = getDIE(GV))
-    return Die;
-
   assert(GV);
 
   auto *GVContext = GV->getScope();
@@ -149,6 +145,10 @@
   DIE *ContextDIE = CB ? getOrCreateCommonBlock(CB, GlobalExprs)
     : getOrCreateContextDIE(GVContext);
 
+  // Check for pre-existence.
+  if (DIE *Die = getDIE(GV))
+    return Die;
+
   // Add to map.
   DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
   DIScope *DeclContext;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113651.386439.patch
Type: text/x-patch
Size: 834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211111/024d4b52/attachment.bin>


More information about the llvm-commits mailing list