[mips] Do not add SecondLastInst to list BranchInstrs if there is only one
authorAkira Hatanaka <ahatanaka@mips.com>
Fri, 1 Mar 2013 01:22:26 +0000 (01:22 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Fri, 1 Mar 2013 01:22:26 +0000 (01:22 +0000)
terminator.

No functionality change.

llvm-svn: 176326

llvm/lib/Target/Mips/MipsInstrInfo.cpp

index be08f837d597260727d07d75342a3f0f3746d13f..ad92d41209e9aa8f4f3a1c019b6503bc9c111acf 100644 (file)
@@ -226,8 +226,6 @@ AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
       return BT_None;
   }
 
-  BranchInstrs.insert(BranchInstrs.begin(), SecondLastInst);
-
   // If there is only one terminator instruction, process it.
   if (!SecondLastOpc) {
     // Unconditional branch
@@ -246,6 +244,8 @@ AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
   if (++I != REnd && isUnpredicatedTerminator(&*I))
     return BT_None;
 
+  BranchInstrs.insert(BranchInstrs.begin(), SecondLastInst);
+
   // If second to last instruction is an unconditional branch,
   // analyze it and remove the last instruction.
   if (SecondLastOpc == UncondBrOpc) {