diff options
| author | Dale Johannesen <dalej@apple.com> | 2007-06-13 17:59:52 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2007-06-13 17:59:52 +0000 |
| commit | c68554683d3046e14d2b6bc9e599fccbbc4f2f1f (patch) | |
| tree | 241279c18db47e7ee0a6059a5a5e1d020966fd1a /llvm/lib/Target | |
| parent | 7413736a7e0941809f9428494929c93de234d2dc (diff) | |
| download | bcm5719-llvm-c68554683d3046e14d2b6bc9e599fccbbc4f2f1f.tar.gz bcm5719-llvm-c68554683d3046e14d2b6bc9e599fccbbc4f2f1f.zip | |
Handle blocks with 2 unconditional branches in AnalyzeBranch.
llvm-svn: 37571
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/ARM/ARMInstrInfo.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/Alpha/AlphaInstrInfo.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 10 |
4 files changed, 40 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.cpp b/llvm/lib/Target/ARM/ARMInstrInfo.cpp index e9c57b25e48..1370faba4d7 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMInstrInfo.cpp @@ -345,6 +345,16 @@ bool ARMInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, return false; } + // If the block ends with two B's or tB's, handle it. The second one is not + // executed, so remove it. + if ((SecondLastOpc == ARM::B || SecondLastOpc==ARM::tB) && + (LastOpc == ARM::B || LastOpc == ARM::tB)) { + TBB = SecondLastInst->getOperand(0).getMachineBasicBlock(); + I = LastInst; + I->eraseFromParent(); + return false; + } + // Otherwise, can't handle this. return true; } diff --git a/llvm/lib/Target/Alpha/AlphaInstrInfo.cpp b/llvm/lib/Target/Alpha/AlphaInstrInfo.cpp index 15f5f841bc3..718587dd292 100644 --- a/llvm/lib/Target/Alpha/AlphaInstrInfo.cpp +++ b/llvm/lib/Target/Alpha/AlphaInstrInfo.cpp @@ -200,6 +200,16 @@ bool AlphaInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TB return false; } + // If the block ends with two Alpha::BRs, handle it. The second one is not + // executed, so remove it. + if (SecondLastInst->getOpcode() == Alpha::BR && + LastInst->getOpcode() == Alpha::BR) { + TBB = SecondLastInst->getOperand(0).getMachineBasicBlock(); + I = LastInst; + I->eraseFromParent(); + return false; + } + // Otherwise, can't handle this. return true; } diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 1ec9e601387..d7ee5ed04e8 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -220,6 +220,16 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, return false; } + // If the block ends with two PPC:Bs, handle it. The second one is not + // executed, so remove it. + if (SecondLastInst->getOpcode() == PPC::B && + LastInst->getOpcode() == PPC::B) { + TBB = SecondLastInst->getOperand(0).getMachineBasicBlock(); + I = LastInst; + I->eraseFromParent(); + return false; + } + // Otherwise, can't handle this. return true; } diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index a3b3223611e..57282d471fc 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -427,6 +427,16 @@ bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, return false; } + // If the block ends with two X86::JMPs, handle it. The second one is not + // executed, so remove it. + if (SecondLastInst->getOpcode() == X86::JMP && + LastInst->getOpcode() == X86::JMP) { + TBB = SecondLastInst->getOperand(0).getMachineBasicBlock(); + I = LastInst; + I->eraseFromParent(); + return false; + } + // Otherwise, can't handle this. return true; } |

