[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

llvm-svn: 213474
This commit is contained in:
Manuel Jacob
2014-07-20 09:10:11 +00:00
parent 4100ebd67b
commit d11beffef4
41 changed files with 166 additions and 226 deletions

View File

@@ -258,10 +258,11 @@ bool Sinking::SinkInstruction(Instruction *Inst,
// If no suitable postdominator was found, look at all the successors and
// decide which one we should sink to, if any.
for (succ_iterator I = succ_begin(Inst->getParent()),
E = succ_end(Inst->getParent()); I != E && !SuccToSinkTo; ++I) {
if (IsAcceptableTarget(Inst, *I))
SuccToSinkTo = *I;
for (BasicBlock *Succ : successors(Inst->getParent())) {
if (SuccToSinkTo)
break;
if (IsAcceptableTarget(Inst, Succ))
SuccToSinkTo = Succ;
}
// If we couldn't find a block to sink to, ignore this instruction.