[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.

llvm-svn: 344808
This commit is contained in:
Craig Topper 2018-10-19 19:24:42 +00:00
parent 6214c11cb7
commit 5c81c68385
1 changed files with 1 additions and 2 deletions

View File

@ -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;