mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 12:02:58 +02:00
s/RemoveUnreachableBlocks/RemoveUnreachableBlocksFromFn/g
llvm-svn: 55965
This commit is contained in:
parent
372133f1c8
commit
7df7366784
@ -148,9 +148,10 @@ static bool MarkAliveBlocks(BasicBlock *BB,
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RemoveUnreachableBlocks - Remove blocks that are not reachable, even if they
|
/// RemoveUnreachableBlocksFromFn - Remove blocks that are not reachable, even
|
||||||
/// are in a dead cycle. Return true if a change was made, false otherwise.
|
/// if they are in a dead cycle. Return true if a change was made, false
|
||||||
static bool RemoveUnreachableBlocks(Function &F) {
|
/// otherwise.
|
||||||
|
static bool RemoveUnreachableBlocksFromFn(Function &F) {
|
||||||
SmallPtrSet<BasicBlock*, 128> Reachable;
|
SmallPtrSet<BasicBlock*, 128> Reachable;
|
||||||
bool Changed = MarkAliveBlocks(F.begin(), Reachable);
|
bool Changed = MarkAliveBlocks(F.begin(), Reachable);
|
||||||
|
|
||||||
@ -208,23 +209,23 @@ static bool IterativeSimplifyCFG(Function &F) {
|
|||||||
// simplify the CFG.
|
// simplify the CFG.
|
||||||
//
|
//
|
||||||
bool CFGSimplifyPass::runOnFunction(Function &F) {
|
bool CFGSimplifyPass::runOnFunction(Function &F) {
|
||||||
bool EverChanged = RemoveUnreachableBlocks(F);
|
bool EverChanged = RemoveUnreachableBlocksFromFn(F);
|
||||||
EverChanged |= IterativeSimplifyCFG(F);
|
EverChanged |= IterativeSimplifyCFG(F);
|
||||||
|
|
||||||
// If neither pass changed anything, we're done.
|
// If neither pass changed anything, we're done.
|
||||||
if (!EverChanged) return false;
|
if (!EverChanged) return false;
|
||||||
|
|
||||||
// IterativeSimplifyCFG can (rarely) make some loops dead. If this happens,
|
// IterativeSimplifyCFG can (rarely) make some loops dead. If this happens,
|
||||||
// RemoveUnreachableBlocks is needed to nuke them, which means we should
|
// RemoveUnreachableBlocksFromFn is needed to nuke them, which means we should
|
||||||
// iterate between the two optimizations. We structure the code like this to
|
// iterate between the two optimizations. We structure the code like this to
|
||||||
// avoid reruning IterativeSimplifyCFG if the second pass of
|
// avoid reruning IterativeSimplifyCFG if the second pass of
|
||||||
// RemoveUnreachableBlocks doesn't do anything.
|
// RemoveUnreachableBlocksFromFn doesn't do anything.
|
||||||
if (!RemoveUnreachableBlocks(F))
|
if (!RemoveUnreachableBlocksFromFn(F))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
EverChanged = IterativeSimplifyCFG(F);
|
EverChanged = IterativeSimplifyCFG(F);
|
||||||
EverChanged |= RemoveUnreachableBlocks(F);
|
EverChanged |= RemoveUnreachableBlocksFromFn(F);
|
||||||
} while (EverChanged);
|
} while (EverChanged);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user