[PATCH] D33891: SelectionDAG: Remove deleted nodes from legalized set to avoid clash with newly created nodes

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 07:54:23 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305084: SelectionDAG: Remove deleted nodes from legalized set to avoid clash with newly… (authored by zvi).

Changed prior to commit:
  https://reviews.llvm.org/D33891?vs=101394&id=102034#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33891

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


Index: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4598,6 +4598,14 @@
   AssignTopologicalOrder();
 
   SmallPtrSet<SDNode *, 16> LegalizedNodes;
+  // Use a delete listener to remove nodes which were deleted during
+  // legalization from LegalizeNodes. This is needed to handle the situation
+  // where a new node is allocated by the object pool to the same address of a
+  // previously deleted node.
+  DAGNodeDeletedListener DeleteListener(
+      *this,
+      [&LegalizedNodes](SDNode *N, SDNode *E) { LegalizedNodes.erase(N); });
+
   SelectionDAGLegalize Legalizer(*this, LegalizedNodes);
 
   // Visit all the nodes. We start in topological order, so that we see


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33891.102034.patch
Type: text/x-patch
Size: 866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/933d7541/attachment.bin>


More information about the llvm-commits mailing list