summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2017-03-01 20:19:38 +0000
committerNirav Dave <niravd@google.com>2017-03-01 20:19:38 +0000
commit0a4703b5ece8df0ed794d351a919aec490b539bb (patch)
tree46b4d69d7f808bf8d2a7c04410510f5296e7b08f /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent3de7fce3acb7d09274a8681afc435e9c39c95978 (diff)
downloadbcm5719-llvm-0a4703b5ece8df0ed794d351a919aec490b539bb.tar.gz
bcm5719-llvm-0a4703b5ece8df0ed794d351a919aec490b539bb.zip
[DAG] Prevent Stale nodes from entering worklist
Add check that deleted nodes do not get added to worklist. This can occur when a node's operand is simplified to an existing node. This fixes PR32108. Reviewers: jyknight, hfinkel, chandlerc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30506 llvm-svn: 296668
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 547655f9f7b..9b467d20e55 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -129,6 +129,9 @@ namespace {
/// Add to the worklist making sure its instance is at the back (next to be
/// processed.)
void AddToWorklist(SDNode *N) {
+ assert(N->getOpcode() != ISD::DELETED_NODE &&
+ "Deleted Node added to Worklist");
+
// Skip handle nodes as they can't usefully be combined and confuse the
// zero-use deletion strategy.
if (N->getOpcode() == ISD::HANDLENODE)
@@ -12619,10 +12622,13 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
Value,
APInt::getLowBitsSet(Value.getScalarValueSizeInBits(),
ST->getMemoryVT().getScalarSizeInBits()))) {
- // Re-visit the store if anything changed; SimplifyDemandedBits
- // will add Value's node back to the worklist if necessary, but
- // we also need to re-visit the Store node itself.
- AddToWorklist(N);
+ // Re-visit the store if anything changed and the store hasn't
+ // been merged with another node (N is deleted);
+ // SimplifyDemandedBits will add Value's node back to the
+ // worklist if necessary, but we also need to re-visit the Store
+ // node itself.
+ if (N->getOpcode() != ISD::DELETED_NODE)
+ AddToWorklist(N);
return SDValue(N, 0);
}
}
OpenPOWER on IntegriCloud