From: Haojian Wu Date: Tue, 20 Jun 2017 09:29:43 +0000 (+0000) Subject: [SelectionDAG] Fix an use-after-free issue introduced in r305775. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=921867e7f1d8da7a6afa4fa591ff2600c6979c44;p=llvm [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 --- 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; } }