[PATCH] D113651: [DwarfCompileUnit] getOrCreateCommonBlock(): check for existing entity first. NFCI

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 14 01:00:51 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b4bfd8c2415: [DwarfCompileUnit] getOrCreateCommonBlock(): check for existing entity first. (authored by krisb).

Changed prior to commit:
  https://reviews.llvm.org/D113651?vs=386753&id=387060#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113651/new/

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
@@ -349,12 +349,10 @@
 
 DIE *DwarfCompileUnit::getOrCreateCommonBlock(
     const DICommonBlock *CB, ArrayRef<GlobalExpr> GlobalExprs) {
-  // Construct the context before querying for the existence of the DIE in case
-  // such construction creates the DIE.
-  DIE *ContextDIE = getOrCreateContextDIE(CB->getScope());
-
+  // Check for pre-existence.
   if (DIE *NDie = getDIE(CB))
     return NDie;
+  DIE *ContextDIE = getOrCreateContextDIE(CB->getScope());
   DIE &NDie = createAndAddDIE(dwarf::DW_TAG_common_block, *ContextDIE, CB);
   StringRef Name = CB->getName().empty() ? "_BLNK_" : CB->getName();
   addString(NDie, dwarf::DW_AT_name, Name);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113651.387060.patch
Type: text/x-patch
Size: 884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211114/18d58347/attachment.bin>


More information about the llvm-commits mailing list