aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Alpha
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-04-02 01:38:09 +0000
committerDale Johannesen <dalej@apple.com>2010-04-02 01:38:09 +0000
commit93d6a7e9c21204c52d6efec6c672163e7de79660 (patch)
tree28f6ac48c327e656e147cb2c4b2b1ecf73ce3dbe /lib/Target/Alpha
parentae1d41c8ae243329c6f0dfcd6abd33a7f89bfa7b (diff)
downloadexternal_llvm-93d6a7e9c21204c52d6efec6c672163e7de79660.zip
external_llvm-93d6a7e9c21204c52d6efec6c672163e7de79660.tar.gz
external_llvm-93d6a7e9c21204c52d6efec6c672163e7de79660.tar.bz2
Teach AnalyzeBranch, RemoveBranch and the branch
folder to be tolerant of debug info following the branch(es) at the end of a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha')
-rw-r--r--lib/Target/Alpha/AlphaInstrInfo.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Target/Alpha/AlphaInstrInfo.cpp b/lib/Target/Alpha/AlphaInstrInfo.cpp
index 39f0749..d539e08 100644
--- a/lib/Target/Alpha/AlphaInstrInfo.cpp
+++ b/lib/Target/Alpha/AlphaInstrInfo.cpp
@@ -301,7 +301,15 @@ bool AlphaInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TB
bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
- if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
+ if (I == MBB.begin())
+ return false;
+ --I;
+ while (I->isDebugValue()) {
+ if (I == MBB.begin())
+ return false;
+ --I;
+ }
+ if (!isUnpredicatedTerminator(I))
return false;
// Get the last instruction in the block.
@@ -362,6 +370,11 @@ unsigned AlphaInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin()) return 0;
--I;
+ while (I->isDebugValue()) {
+ if (I == MBB.begin())
+ return 0;
+ --I;
+ }
if (I->getOpcode() != Alpha::BR &&
I->getOpcode() != Alpha::COND_BRANCH_I &&
I->getOpcode() != Alpha::COND_BRANCH_F)