Correct a glitch in r194424 which may invalidate iterator.

llvm-svn: 194457
This commit is contained in:
Shuxin Yang 2013-11-12 08:33:03 +00:00
parent 72c83a867c
commit f1ec34bdfd
1 changed files with 3 additions and 1 deletions

View File

@ -2730,7 +2730,9 @@ void GVN::addDeadBlock(BasicBlock *BB) {
if (DeadBlocks.count(B))
continue;
for (pred_iterator PI = pred_begin(B), PE = pred_end(B); PI != PE; PI++) {
SmallVector<BasicBlock *, 4> Preds(pred_begin(B), pred_end(B));
for (SmallVectorImpl<BasicBlock *>::iterator PI = Preds.begin(),
PE = Preds.end(); PI != PE; PI++) {
BasicBlock *P = *PI;
if (!DeadBlocks.count(P))