[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges.

Summary: This patch introduces two new iterator ranges and updates existing code to use it.  No functional change intended.

Test Plan: All tests (make check-all) still pass.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D4481

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manuel Jacob
2014-07-20 09:10:11 +00:00
parent 83a385a57b
commit a4697dad19
41 changed files with 166 additions and 226 deletions

View File

@ -91,9 +91,8 @@ static SetVector<BasicBlock *> buildExtractionBlockSet(IteratorT BBBegin,
for (SetVector<BasicBlock *>::iterator I = std::next(Result.begin()),
E = Result.end();
I != E; ++I)
for (pred_iterator PI = pred_begin(*I), PE = pred_end(*I);
PI != PE; ++PI)
assert(Result.count(*PI) &&
for (BasicBlock *Pred : predecessors(*I))
assert(Result.count(Pred) &&
"No blocks in this region may have entries from outside the region"
" except for the first block!");
#endif
@ -721,9 +720,9 @@ Function *CodeExtractor::extractCodeRegion() {
SmallPtrSet<BasicBlock *, 1> ExitBlocks;
for (SetVector<BasicBlock *>::iterator I = Blocks.begin(), E = Blocks.end();
I != E; ++I)
for (succ_iterator SI = succ_begin(*I), SE = succ_end(*I); SI != SE; ++SI)
if (!Blocks.count(*SI))
ExitBlocks.insert(*SI);
for (BasicBlock *Succ : successors(*I))
if (!Blocks.count(Succ))
ExitBlocks.insert(Succ);
NumExitBlocks = ExitBlocks.size();
// Construct new function based on inputs/outputs & add allocas for all defs.