diff options
author | Sumanth Gundapaneni <sgundapa@quicinc.com> | 2019-11-14 13:08:06 -0600 |
---|---|---|
committer | Sumanth Gundapaneni <sgundapa@quicinc.com> | 2019-11-14 13:08:06 -0600 |
commit | 7c7e368a7ffc33be7c7bbf1d8149803b32b8c0a8 (patch) | |
tree | 0bd19c79e9b9164029f31c06c18d7b0187f552e9 /llvm/lib/CodeGen/MachinePipeliner.cpp | |
parent | fdf1ae37cfa8718c9c4f060ad1186a57a36ca3f8 (diff) | |
download | llvm-7c7e368a7ffc33be7c7bbf1d8149803b32b8c0a8.zip llvm-7c7e368a7ffc33be7c7bbf1d8149803b32b8c0a8.tar.gz llvm-7c7e368a7ffc33be7c7bbf1d8149803b32b8c0a8.tar.bz2 |
[Pipeliner] Fix an assertion caused by iterator invalidation.
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 89c9f60..ef22caa 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -1314,8 +1314,9 @@ void SwingSchedulerDAG::CopyToPhiMutation::apply(ScheduleDAGInstrs *DAG) { // Find the USEs of PHI. If the use is a PHI or REG_SEQUENCE, push back this // SUnit to the container. SmallVector<SUnit *, 8> UseSUs; - for (auto I = PHISUs.begin(); I != PHISUs.end(); ++I) { - for (auto &Dep : (*I)->Succs) { + // Do not use iterator based loop here as we are updating the container. + for (size_t Index = 0; Index < PHISUs.size(); ++Index) { + for (auto &Dep : PHISUs[Index]->Succs) { if (Dep.getKind() != SDep::Data) continue; |