[llvm] r194457 - Correct a glitch in r194424 which may invalidate iterator.
Shuxin Yang
shuxin.llvm at gmail.com
Tue Nov 12 00:33:03 PST 2013
Author: shuxin_yang
Date: Tue Nov 12 02:33:03 2013
New Revision: 194457
URL: http://llvm.org/viewvc/llvm-project?rev=194457&view=rev
Log:
Correct a glitch in r194424 which may invalidate iterator.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=194457&r1=194456&r2=194457&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Tue Nov 12 02:33:03 2013
@@ -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))
More information about the llvm-commits
mailing list