[PATCH] D113864: Don't add irrelevant items to queue in DwarfCompileUnit::createScopeChildrenDIE (NFC)

Aaron Puchert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 16 15:01:40 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb20da5117fb6: Don't add irrelevant items to queue in DwarfCompileUnit::createScopeChildrenDIE… (authored by aaronpuchert).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113864

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
@@ -980,9 +980,7 @@
     bool visitedAllDependencies = Item.getInt();
     WorkList.pop_back();
 
-    // Dependency is in a different lexical scope or a global.
-    if (!Var)
-      continue;
+    assert(Var);
 
     // Already handled.
     if (Visited.count(Var))
@@ -1006,8 +1004,10 @@
     // visited again after all of its dependencies are handled.
     WorkList.push_back({Var, 1});
     for (auto *Dependency : dependencies(Var)) {
-      auto Dep = dyn_cast_or_null<const DILocalVariable>(Dependency);
-      WorkList.push_back({DbgVar[Dep], 0});
+      // Don't add dependency if it is in a different lexical scope or a global.
+      if (const auto *Dep = dyn_cast<const DILocalVariable>(Dependency))
+        if (DbgVariable *Var = DbgVar.lookup(Dep))
+          WorkList.push_back({Var, 0});
     }
   }
   return Result;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113864.387771.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211116/92e16198/attachment.bin>


More information about the llvm-commits mailing list