[llvm-commits] [llvm] r52903 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp

Duncan Sands baldrick at free.fr
Mon Jun 30 09:43:45 PDT 2008


Author: baldrick
Date: Mon Jun 30 11:43:45 2008
New Revision: 52903

URL: http://llvm.org/viewvc/llvm-project?rev=52903&view=rev
Log:
ExpungeNode is only needed for new nodes!  This
fixes CodeGen/PowerPC/2008-06-19-LegalizerCrash.ll
when using the new LegalizeTypes infrastructure.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=52903&r1=52902&r2=52903&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Jun 30 11:43:45 2008
@@ -364,16 +364,19 @@
   }
 }
 
-/// ExpungeNode - If this is a deleted value that was kept around to speed up
-/// remapping, remove it globally now.  The only map that can have a deleted
-/// node as a source is ReplacedNodes.  Other maps can have deleted nodes as
-/// targets, but since their looked-up values are always immediately remapped
-/// using RemapNode, resulting in a not-deleted node, this is harmless as long
-/// as ReplacedNodes/RemapNode always performs correct mappings.  The mapping
-/// will always be correct as long as ExpungeNode is called on the source when
-/// adding a new node to ReplacedNodes, and called on the target when adding
-/// a new node to any map.
+/// ExpungeNode - If this is a reincarnation of a deleted value that was kept
+/// around to speed up remapping, remove it from all maps now.  The only map
+/// that can have a deleted node as a source is ReplacedNodes.  Other maps can
+/// have deleted nodes as targets, but since their looked-up values are always
+/// immediately remapped using RemapNode, resulting in a not-deleted node, this
+/// is harmless as long as ReplacedNodes/RemapNode always performs correct
+/// mappings.  The mapping will always be correct as long as ExpungeNode is
+/// called on the source when adding a new node to ReplacedNodes, and called on
+/// the target when adding a new node to any map.
 void DAGTypeLegalizer::ExpungeNode(SDOperand N) {
+  if (N.Val->getNodeId() != NewNode)
+    return;
+
   SDOperand Replacement = N;
   RemapNode(Replacement);
   if (Replacement != N) {





More information about the llvm-commits mailing list