[PATCH] D30506: [DAG] Prevent Stale nodes from entering worklist

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 10:50:54 PST 2017


niravd created this revision.

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.


https://reviews.llvm.org/D30506

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/X86/pr32108.ll


Index: test/CodeGen/X86/pr32108.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/pr32108.ll
@@ -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
+}
Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -133,6 +133,10 @@
       // zero-use deletion strategy.
       if (N->getOpcode() == ISD::HANDLENODE)
         return;
+      // Don't add deleted nodes. This can happen when a change
+      // to a operand causes redundancies.
+      if (N->getOpcode() == ISD::DELETED_NODE)
+        return;
 
       if (WorklistMap.insert(std::make_pair(N, Worklist.size())).second)
         Worklist.push_back(N);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30506.90209.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170301/17dcc2e8/attachment.bin>


More information about the llvm-commits mailing list