[PATCH] D16382: Add LoopSimplifyCFG pass
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 20 21:40:44 PST 2016
majnemer added a subscriber: majnemer.
================
Comment at: lib/Transforms/Scalar/LoopSimplifyCFG.cpp:105
@@ +104,3 @@
+ L->moveToHeader(Succ);
+ LI->removeBlock(Pred);
+ MergeBasicBlockIntoOnlyPred(Succ, DT);
----------------
escha wrote:
> sanjoy wrote:
> > Won't this invalidate `E`?
> I don't *think* so? This only modifies things earlier in the list, not later. Should I recalculate E on each iteration just to be sure?
`Loop::block_end` accesses the end iterator of a vector. `LoopInfo::removeBlock` calls `Loop::removeBlockFromLoop` which will `erase` an element from the vector. `std::vector::erase` invalidates all iterators at or beyond the point of the erase including the vector's `end` iterator.
Repository:
rL LLVM
http://reviews.llvm.org/D16382
More information about the llvm-commits
mailing list