[llvm] r344808 - [X86] In PostprocessISelDAG, start from allnodes_end, not the root.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 19 12:24:42 PDT 2018


Author: ctopper
Date: Fri Oct 19 12:24:42 2018
New Revision: 344808

URL: http://llvm.org/viewvc/llvm-project?rev=344808&view=rev
Log:
[X86] In PostprocessISelDAG, start from allnodes_end, not the root.

There is no guarantee the root is at the end if isel created any nodes without morphing them. This includes the nodes created by manual isel from C++ code in X86ISelDAGToDAG.

This is similar to r333415 from PowerPC which is where I originally stole the peephole loop from.

I don't have a test case, but without this a future patch doesn't work which is how I found it.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=344808&r1=344807&r2=344808&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Oct 19 12:24:42 2018
@@ -849,8 +849,7 @@ void X86DAGToDAGISel::PostprocessISelDAG
 
   // Attempt to remove vectors moves that were inserted to zero upper bits.
 
-  SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode());
-  ++Position;
+  SelectionDAG::allnodes_iterator Position = CurDAG->allnodes_end();
 
   while (Position != CurDAG->allnodes_begin()) {
     SDNode *N = &*--Position;




More information about the llvm-commits mailing list