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

Duncan Sands baldrick at free.fr
Mon Oct 27 06:18:32 PDT 2008


Author: baldrick
Date: Mon Oct 27 08:18:32 2008
New Revision: 58246

URL: http://llvm.org/viewvc/llvm-project?rev=58246&view=rev
Log:
Fix a bug in which a node could be added to the
worklist twice: UpdateNodeOperands could morph
a new node into a node already on the worklist.
We would then recalculate the NodeId for this
existing node and add it to the worklist.  The
testcase is ARM/cse-libcalls.ll, the problem
showing up once UpdateNodeOperands is taught to
do CSE for calls.

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=58246&r1=58245&r2=58246&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Oct 27 08:18:32 2008
@@ -272,9 +272,14 @@
                                &NewOps[0],
                                NewOps.size()).getNode();
 
-  N->setNodeId(N->getNumOperands()-NumProcessed);
-  if (N->getNodeId() == ReadyToProcess)
-    Worklist.push_back(N);
+  // Calculate the NodeId if we haven't morphed into an existing node for
+  // which it is already known.
+  if (N->getNodeId() == NewNode) {
+    N->setNodeId(N->getNumOperands()-NumProcessed);
+    if (N->getNodeId() == ReadyToProcess)
+      Worklist.push_back(N);
+  }
+
   return N;
 }
 





More information about the llvm-commits mailing list