SDAGBuilder: Avoid iterator invalidation harder.

vector.begin()-1 is invalid too.

llvm-svn: 157525
This commit is contained in:
Benjamin Kramer 2012-05-27 09:44:52 +00:00
parent 5511dfb399
commit 48ff2751c1
1 changed files with 1 additions and 1 deletions

View File

@ -1991,7 +1991,7 @@ bool SelectionDAGBuilder::handleSmallSwitchRange(CaseRec& CR,
// The last case block won't fall through into 'NextBlock' if we emit the
// branches in this order. See if rearranging a case value would help.
// We start at the bottom as it's the case with the least weight.
for (CaseItr I = CR.Range.second-2, E = CR.Range.first-1; I != E; --I) {
for (CaseItr I = CR.Range.second-2, E = CR.Range.first; I >= E; --I) {
if (I->BB == NextBlock) {
std::swap(*I, BackCase);
break;