From 921867e7f1d8da7a6afa4fa591ff2600c6979c44 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 20 Jun 2017 09:29:43 +0000 Subject: [PATCH] [SelectionDAG] Fix an use-after-free issue introduced in r305775. vector.back() will be invalidated when memory reallocation happens. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305785 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp index c90747943f5..70b1fa77a09 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp @@ -1888,10 +1888,10 @@ CalcNodeSethiUllmanNumber(const SUnit *SU, std::vector &SUNumbers) { 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; } } -- 2.50.1