Remove isAccessable.

llvm-svn: 34497
This commit is contained in:
Jim Laskey 2007-02-22 16:39:03 +00:00
parent 69bd45c1d2
commit 9df1a1d8d8
2 changed files with 4 additions and 8 deletions

View File

@ -165,10 +165,6 @@ public:
/// this basic block is entered via an exception handler. /// this basic block is entered via an exception handler.
void setIsLandingPad() { IsLandingPad = true; } void setIsLandingPad() { IsLandingPad = true; }
/// isAccessable - Returns true if the block is alive. That is, if it has
/// predecessors or is an eh landing pad.
bool isAccessable() const { return !pred_empty() || isLandingPad(); }
// Code Layout methods. // Code Layout methods.
/// moveBefore/moveAfter - move 'this' block before or after the specified /// moveBefore/moveAfter - move 'this' block before or after the specified

View File

@ -67,7 +67,7 @@ FunctionPass *llvm::createBranchFoldingPass() { return new BranchFolder(); }
/// RemoveDeadBlock - Remove the specified dead machine basic block from the /// RemoveDeadBlock - Remove the specified dead machine basic block from the
/// function, updating the CFG. /// function, updating the CFG.
void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) { void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) {
assert(!MBB->isAccessable() && "MBB must be dead!"); assert(MBB->pred_empty() && "MBB must be dead!");
DOUT << "\nRemoving MBB: " << *MBB; DOUT << "\nRemoving MBB: " << *MBB;
MachineFunction *MF = MBB->getParent(); MachineFunction *MF = MBB->getParent();
@ -440,7 +440,7 @@ bool BranchFolder::OptimizeBranches(MachineFunction &MF) {
OptimizeBlock(MBB); OptimizeBlock(MBB);
// If it is dead, remove it. // If it is dead, remove it.
if (!MBB->isAccessable()) { if (MBB->pred_empty()) {
RemoveDeadBlock(MBB); RemoveDeadBlock(MBB);
MadeChange = true; MadeChange = true;
++NumDeadBlocks; ++NumDeadBlocks;
@ -618,14 +618,14 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
// explicitly. // explicitly.
if (MBB->empty()) { if (MBB->empty()) {
// Dead block? Leave for cleanup later. // Dead block? Leave for cleanup later.
if (!MBB->isAccessable()) return; if (MBB->pred_empty()) return;
if (FallThrough == MBB->getParent()->end()) { if (FallThrough == MBB->getParent()->end()) {
// TODO: Simplify preds to not branch here if possible! // TODO: Simplify preds to not branch here if possible!
} else { } else {
// Rewrite all predecessors of the old block to go to the fallthrough // Rewrite all predecessors of the old block to go to the fallthrough
// instead. // instead.
while (MBB->isAccessable()) { while (!MBB->pred_empty()) {
MachineBasicBlock *Pred = *(MBB->pred_end()-1); MachineBasicBlock *Pred = *(MBB->pred_end()-1);
ReplaceUsesOfBlockWith(Pred, MBB, FallThrough, TII); ReplaceUsesOfBlockWith(Pred, MBB, FallThrough, TII);
} }