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

This reverts commit r213474 (and r213475), which causes a miscompile on
a stage2 LTO build.  I'll reply on the list in a moment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213562 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2014-07-21 17:06:51 +00:00
parent 9787e8c76b
commit facdfc6781
41 changed files with 230 additions and 167 deletions
+8 -8
View File
@@ -1129,8 +1129,8 @@ static void changeToUnreachable(Instruction *I, bool UseLLVMTrap) {
BasicBlock *BB = I->getParent();
// Loop over all of the successors, removing BB's entry from any PHI
// nodes.
for (BasicBlock *Succ : successors(BB))
Succ->removePredecessor(BB);
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
(*SI)->removePredecessor(BB);
// Insert a call to llvm.trap right before this. This turns the undefined
// behavior into a hard fail instead of falling through into random code.
@@ -1236,9 +1236,9 @@ static bool markAliveBlocks(BasicBlock *BB,
}
Changed |= ConstantFoldTerminator(BB, true);
for (BasicBlock *Succ : successors(BB))
if (Reachable.insert(Succ))
Worklist.push_back(Succ);
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
if (Reachable.insert(*SI))
Worklist.push_back(*SI);
} while (!Worklist.empty());
return Changed;
}
@@ -1263,9 +1263,9 @@ bool llvm::removeUnreachableBlocks(Function &F) {
if (Reachable.count(BB))
continue;
for (BasicBlock *Succ : successors(BB))
if (Reachable.count(Succ))
Succ->removePredecessor(BB);
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
if (Reachable.count(*SI))
(*SI)->removePredecessor(BB);
BB->dropAllReferences();
}