[llvm] r296668 - [DAG] Prevent Stale nodes from entering worklist
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 1 12:19:38 PST 2017
Author: niravd
Date: Wed Mar 1 14:19:38 2017
New Revision: 296668
URL: http://llvm.org/viewvc/llvm-project?rev=296668&view=rev
Log:
[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
Added:
llvm/trunk/test/CodeGen/X86/pr32108.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=296668&r1=296667&r2=296668&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Mar 1 14:19:38 2017
@@ -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 *
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);
}
}
Added: llvm/trunk/test/CodeGen/X86/pr32108.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr32108.ll?rev=296668&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr32108.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr32108.ll Wed Mar 1 14:19:38 2017
@@ -0,0 +1,20 @@
+; RUN: llc -march=x86-64 %s -o -
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @autogen_SD1794() {
+BB:
+ %Cmp45 = icmp slt <4 x i32> undef, undef
+ br label %CF243
+
+CF243: ; preds = %CF243, %BB
+ br i1 undef, label %CF243, label %CF257
+
+CF257: ; preds = %CF243
+ %Shuff144 = shufflevector <4 x i1> undef, <4 x i1> %Cmp45, <4 x i32> <i32 undef, i32 undef, i32 5, i32 undef>
+ br label %CF244
+
+CF244: ; preds = %CF244, %CF257
+ %Shuff182 = shufflevector <4 x i1> %Shuff144, <4 x i1> zeroinitializer, <4 x i32> <i32 3, i32 5, i32 7, i32 undef>
+ br label %CF244
+}
More information about the llvm-commits
mailing list