mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
Simplify this code: don't call AnalyzeBranch before doing simpler checks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90633 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -363,11 +363,6 @@ bool MachineBasicBlock::isLayoutSuccessor(const MachineBasicBlock *MBB) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MachineBasicBlock::canFallThrough() {
|
bool MachineBasicBlock::canFallThrough() {
|
||||||
MachineBasicBlock *TBB = 0, *FBB = 0;
|
|
||||||
SmallVector<MachineOperand, 4> Cond;
|
|
||||||
const TargetInstrInfo *TII = getParent()->getTarget().getInstrInfo();
|
|
||||||
bool BranchUnAnalyzable = TII->AnalyzeBranch(*this, TBB, FBB, Cond, true);
|
|
||||||
|
|
||||||
MachineFunction::iterator Fallthrough = this;
|
MachineFunction::iterator Fallthrough = this;
|
||||||
++Fallthrough;
|
++Fallthrough;
|
||||||
// If FallthroughBlock is off the end of the function, it can't fall through.
|
// If FallthroughBlock is off the end of the function, it can't fall through.
|
||||||
@@ -378,16 +373,21 @@ bool MachineBasicBlock::canFallThrough() {
|
|||||||
if (!isSuccessor(Fallthrough))
|
if (!isSuccessor(Fallthrough))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If we couldn't analyze the branch, examine the last instruction.
|
// Analyze the branches, if any, at the end of the block.
|
||||||
// If the block doesn't end in a known control barrier, assume fallthrough
|
MachineBasicBlock *TBB = 0, *FBB = 0;
|
||||||
// is possible. The isPredicable check is needed because this code can be
|
SmallVector<MachineOperand, 4> Cond;
|
||||||
// called during IfConversion, where an instruction which is normally a
|
const TargetInstrInfo *TII = getParent()->getTarget().getInstrInfo();
|
||||||
// Barrier is predicated and thus no longer an actual control barrier. This
|
if (TII->AnalyzeBranch(*this, TBB, FBB, Cond, true)) {
|
||||||
// is over-conservative though, because if an instruction isn't actually
|
// If we couldn't analyze the branch, examine the last instruction.
|
||||||
// predicated we could still treat it like a barrier.
|
// If the block doesn't end in a known control barrier, assume fallthrough
|
||||||
if (BranchUnAnalyzable)
|
// is possible. The isPredicable check is needed because this code can be
|
||||||
|
// called during IfConversion, where an instruction which is normally a
|
||||||
|
// Barrier is predicated and thus no longer an actual control barrier. This
|
||||||
|
// is over-conservative though, because if an instruction isn't actually
|
||||||
|
// predicated we could still treat it like a barrier.
|
||||||
return empty() || !back().getDesc().isBarrier() ||
|
return empty() || !back().getDesc().isBarrier() ||
|
||||||
back().getDesc().isPredicable();
|
back().getDesc().isPredicable();
|
||||||
|
}
|
||||||
|
|
||||||
// If there is no branch, control always falls through.
|
// If there is no branch, control always falls through.
|
||||||
if (TBB == 0) return true;
|
if (TBB == 0) return true;
|
||||||
|
Reference in New Issue
Block a user