[llvm-commits] [llvm] r83166 - /llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
Dan Gohman
gohman at apple.com
Wed Sep 30 13:54:16 PDT 2009
Author: djg
Date: Wed Sep 30 15:54:16 2009
New Revision: 83166
URL: http://llvm.org/viewvc/llvm-project?rev=83166&view=rev
Log:
Fix this code so that it doesn't try to iterate through a std::vector
while calling changeImmediateDominator, which removes elements from the
vector. This fixes PR5097.
Modified:
llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=83166&r1=83165&r2=83166&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Wed Sep 30 15:54:16 2009
@@ -274,9 +274,10 @@
DomTreeNode *Node = DT->getNode(ExitingBlock);
const std::vector<DomTreeNodeBase<BasicBlock> *> &Children =
Node->getChildren();
- for (unsigned k = 0, g = Children.size(); k != g; ++k) {
- DT->changeImmediateDominator(Children[k], Node->getIDom());
- if (DF) DF->changeImmediateDominator(Children[k]->getBlock(),
+ while (!Children.empty()) {
+ DomTreeNode *Child = Children.front();
+ DT->changeImmediateDominator(Child, Node->getIDom());
+ if (DF) DF->changeImmediateDominator(Child->getBlock(),
Node->getIDom()->getBlock(),
DT);
}
More information about the llvm-commits
mailing list