From 1c88445840c5412965d4bbee6f558d0dd7aed9b4 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Thu, 13 Jun 2019 21:51:12 +0000 Subject: [MachinePiepliner] Don't check boundary node in checkValidNodeOrder This was exposed by PowerPC target enablement. In ScheduleDAG, if we haven't seen any uses in this scheduling region, we will create a dependence edge to ExitSU to model the live-out latency. This is required for vreg defs with no in-region use, and prefetches with no vreg def. When we build NodeOrder in Scheduler, we ignore these boundary nodes. However, when we check Succs in checkValidNodeOrder, we did not skip them, so we still assume all the nodes have been sorted and in order in Indices array. So when we call lower_bound() for ExitSU, it will return Indices.end(), causing memory issues in following Node access. Differential Revision: https://reviews.llvm.org/D63282 llvm-svn: 363329 --- llvm/lib/CodeGen/MachinePipeliner.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp') diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 81917abae08..30ac94eb9c3 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -3732,6 +3732,11 @@ void SwingSchedulerDAG::checkValidNodeOrder(const NodeSetType &Circuits) const { for (SDep &SuccEdge : SU->Succs) { SUnit *SuccSU = SuccEdge.getSUnit(); + // Do not process a boundary node, it was not included in NodeOrder, + // hence not in Indices either, call to std::lower_bound() below will + // return Indices.end(). + if (SuccSU->isBoundaryNode()) + continue; unsigned SuccIndex = std::get<1>(*std::lower_bound(Indices.begin(), Indices.end(), std::make_pair(SuccSU, 0), CompareKey)); -- cgit v1.2.3