diff options
author | Duncan Sands <baldrick@free.fr> | 2008-10-27 13:18:32 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-10-27 13:18:32 +0000 |
commit | 20f04e9fdd437712b323661e5041fd88431185b3 (patch) | |
tree | 1e9d5788caec2197a66bce59cd5d1edfab860e33 /lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | |
parent | c83889ad906b130f39ba8f776111e51439c2a7ac (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypes.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 55acc82211..b236558867 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/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; } |