[PATCH] D61164: [X86] If PreprocessISelDAG reorders a load before a call, make sure we remove dead nodes from the graph

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 10:58:17 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359582: [X86] If PreprocessISelDAG reorders a load before a call, make sure we removeā€¦ (authored by ctopper, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61164?vs=197179&id=197380#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61164/new/

https://reviews.llvm.org/D61164

Files:
  llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/trunk/test/CodeGen/X86/fold-call-3.ll


Index: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -907,6 +907,11 @@
     ++I;
     CurDAG->DeleteNode(N);
   }
+
+  // The load+call transform above can leave some dead nodes in the graph. Make
+  // sure we remove them. Its possible some of the other transforms do to so
+  // just remove dead nodes unconditionally.
+  CurDAG->RemoveDeadNodes();
 }
 
 // Look for a redundant movzx/movsx that can occur after an 8-bit divrem.
Index: llvm/trunk/test/CodeGen/X86/fold-call-3.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/fold-call-3.ll
+++ llvm/trunk/test/CodeGen/X86/fold-call-3.ll
@@ -1,5 +1,7 @@
 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | grep call | grep 560
 ; rdar://6522427
+; This command line used to crash due to dangling nodes left after PreprocessISelDAG
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -pre-RA-sched=linearize
 
 	%"struct.clang::Action" = type { %"struct.clang::ActionBase" }
 	%"struct.clang::ActionBase" = type { i32 (...)** }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61164.197380.patch
Type: text/x-patch
Size: 1193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190430/cc0e1e8c/attachment-0001.bin>


More information about the llvm-commits mailing list