summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-10-27 13:18:32 +0000
committerDuncan Sands <baldrick@free.fr>2008-10-27 13:18:32 +0000
commit75cf2e03abd2ee44bc44decdcb302dbd1faba221 (patch)
tree7406912cf20ca34014b2b8e4e3c68b5082500ec3 /llvm/lib/CodeGen/SelectionDAG
parent7b700575dde6c4973a2fbb98b02ffebcd8a42e45 (diff)
downloadbcm5719-llvm-75cf2e03abd2ee44bc44decdcb302dbd1faba221.tar.gz
bcm5719-llvm-75cf2e03abd2ee44bc44decdcb302dbd1faba221.zip
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. llvm-svn: 58246
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index 55acc822114..b2365588671 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -272,9 +272,14 @@ SDNode *DAGTypeLegalizer::AnalyzeNewNode(SDNode *N) {
&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;
}
OpenPOWER on IntegriCloud