diff options
author | Shuxin Yang <shuxin.llvm@gmail.com> | 2013-11-12 08:33:03 +0000 |
---|---|---|
committer | Shuxin Yang <shuxin.llvm@gmail.com> | 2013-11-12 08:33:03 +0000 |
commit | e26299d76e4b1ef0fa9bfc89d55dd1a28a1220f4 (patch) | |
tree | 827d5ce1eca6bd2bcecbe8dd33677b3a8e48d66f /lib/Transforms/Scalar | |
parent | c3f4491d91c994a7fe65b2858e33c66e7a4e9f66 (diff) | |
download | external_llvm-e26299d76e4b1ef0fa9bfc89d55dd1a28a1220f4.zip external_llvm-e26299d76e4b1ef0fa9bfc89d55dd1a28a1220f4.tar.gz external_llvm-e26299d76e4b1ef0fa9bfc89d55dd1a28a1220f4.tar.bz2 |
Correct a glitch in r194424 which may invalidate iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index d353765..6af269d 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -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)) |