[PATCH] D41589: Avoid modifying DbgInfo while looping in salvageDebuginfo

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 15:43:50 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL321545: Avoid modifying DbgInfo while looping in salvageDebuginfo (authored by dim, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D41589

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp


Index: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -7128,6 +7128,8 @@
 void SelectionDAG::salvageDebugInfo(SDNode &N) {
   if (!N.getHasDebugValue())
     return;
+
+  SmallVector<SDDbgValue *, 2> ClonedDVs;
   for (auto DV : GetDbgValues(&N)) {
     if (DV->isInvalidated())
       continue;
@@ -7151,13 +7153,16 @@
         SDDbgValue *Clone =
             getDbgValue(DV->getVariable(), DIExpr, N0.getNode(), N0.getResNo(),
                         DV->isIndirect(), DV->getDebugLoc(), DV->getOrder());
+        ClonedDVs.push_back(Clone);
         DV->setIsInvalidated();
-        AddDbgValue(Clone, N0.getNode(), false);
         DEBUG(dbgs() << "SALVAGE: Rewriting"; N0.getNode()->dumprFull(this);
               dbgs() << " into " << *DIExpr << '\n');
       }
     }
   }
+
+  for (SDDbgValue *Dbg : ClonedDVs)
+    AddDbgValue(Dbg, Dbg->getSDNode(), false);
 }
 
 namespace {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41589.128310.patch
Type: text/x-patch
Size: 1079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171228/53fd6fa2/attachment.bin>


More information about the llvm-commits mailing list