[SelectionDAG] Fix an use-after-free issue introduced in r305775.

vector.back() will be invalidated when memory reallocation happens.

llvm-svn: 305785
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index c907479..70b1fa7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -1888,10 +1888,10 @@
         for (auto It : WorkList)
           assert(It.SU != PredSU && "Trying to push an element twice?");
 #endif
-        WorkList.push_back(PredSU);
-        AllPredsKnown = false;
         // Next time start processing this one starting from the next pred.
         Temp.PredsProcessed = P + 1;
+        WorkList.push_back(PredSU);
+        AllPredsKnown = false;
         break;
       }
     }