mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
revert r98550, it isn't necessary or sufficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -58,25 +58,13 @@ FunctionPass *llvm::createUnreachableBlockEliminationPass() {
|
|||||||
return new UnreachableBlockElim();
|
return new UnreachableBlockElim();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MarkReachableFrom(BasicBlock *BB,
|
|
||||||
SmallPtrSet<BasicBlock*, 8> &Reachable) {
|
|
||||||
for (df_ext_iterator<BasicBlock*, SmallPtrSet<BasicBlock*, 8> > I =
|
|
||||||
df_ext_begin(BB, Reachable), E = df_ext_end(BB, Reachable); I != E; ++I)
|
|
||||||
; // Mark all reachable blocks.
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UnreachableBlockElim::runOnFunction(Function &F) {
|
bool UnreachableBlockElim::runOnFunction(Function &F) {
|
||||||
SmallPtrSet<BasicBlock*, 8> Reachable;
|
SmallPtrSet<BasicBlock*, 8> Reachable;
|
||||||
|
|
||||||
// Mark all reachable blocks.
|
// Mark all reachable blocks.
|
||||||
MarkReachableFrom(&F.getEntryBlock(), Reachable);
|
for (df_ext_iterator<Function*, SmallPtrSet<BasicBlock*, 8> > I =
|
||||||
|
df_ext_begin(&F, Reachable), E = df_ext_end(&F, Reachable); I != E; ++I)
|
||||||
// Mark any address-taken blocks. We don't want codegen to delete these
|
/* Mark all reachable blocks */;
|
||||||
// because the address may already be referenced by another function and the
|
|
||||||
// label may be referenced.
|
|
||||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
|
||||||
if (I->hasAddressTaken() && !Reachable.count(I))
|
|
||||||
MarkReachableFrom(I, Reachable);
|
|
||||||
|
|
||||||
// Loop over all dead blocks, remembering them and deleting all instructions
|
// Loop over all dead blocks, remembering them and deleting all instructions
|
||||||
// in them.
|
// in them.
|
||||||
|
Reference in New Issue
Block a user