mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Remove unnecessary gotos to fall-thru successors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9357754d09
commit
e70b897126
@ -214,3 +214,25 @@ InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
||||
// returning NULL.
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool PIC16InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock *&TBB,
|
||||
MachineBasicBlock *&FBB,
|
||||
SmallVectorImpl<MachineOperand> &Cond,
|
||||
bool AllowModify) const {
|
||||
MachineBasicBlock::iterator I = MBB.end();
|
||||
if (I == MBB.begin())
|
||||
return true;
|
||||
|
||||
// Get the terminator instruction.
|
||||
--I;
|
||||
// Handle unconditional branches. If the unconditional branch's target is
|
||||
// successor basic block then remove the unconditional branch.
|
||||
if (I->getOpcode() == PIC16::br_uncond && AllowModify) {
|
||||
if (MBB.isLayoutSuccessor(I->getOperand(0).getMBB())) {
|
||||
TBB = 0;
|
||||
I->eraseFromParent();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -68,7 +68,10 @@ public:
|
||||
unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
||||
MachineBasicBlock *FBB,
|
||||
const SmallVectorImpl<MachineOperand> &Cond) const;
|
||||
|
||||
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
||||
MachineBasicBlock *&FBB,
|
||||
SmallVectorImpl<MachineOperand> &Cond,
|
||||
bool AllowModify) const;
|
||||
};
|
||||
} // namespace llvm
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user