diff options
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCInstrInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 80530ec19be..1e4cc4a3c80 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -494,6 +494,20 @@ bool PPCInstrInfo::analyzeBranch(MachineBasicBlock &MBB,    if (!isUnpredicatedTerminator(*I))      return false; +  if (AllowModify) { +    // If the BB ends with an unconditional branch to the fallthrough BB, +    // we eliminate the branch instruction. +    if (I->getOpcode() == PPC::B && +        MBB.isLayoutSuccessor(I->getOperand(0).getMBB())) { +      I->eraseFromParent(); + +      // We update iterator after deleting the last branch. +      I = MBB.getLastNonDebugInstr(); +      if (I == MBB.end() || !isUnpredicatedTerminator(*I)) +        return false; +    } +  } +    // Get the last instruction in the block.    MachineInstr &LastInst = *I; | 

