SIL: Avoid dereferencing sentinel nodes in ilist_iterators

The behaviour of ilist has changed in LLVM.  It is no longer permissible to
dereference the `end()` value.  Add a check to ensure that we do not
accidentally dereference the iterator.
This commit is contained in:
Francis Ricci
2016-10-05 17:10:41 -07:00
committed by Saleem Abdulrasool
parent 7d1da2af3d
commit 66dcad0d34
8 changed files with 45 additions and 37 deletions

View File

@@ -130,8 +130,7 @@ SILGenFunction::emitEpilogBB(SILLocation TopLevel) {
B.setInsertionPoint(pred);
} else {
// Move the epilog block to the end of the ordinary section.
auto endOfOrdinarySection =
(StartOfPostmatter ? SILFunction::iterator(StartOfPostmatter) : F.end());
auto endOfOrdinarySection = StartOfPostmatter;
B.moveBlockTo(epilogBB, endOfOrdinarySection);
// Emit the epilog into the epilog bb. Its arguments are the