Remove attribution from file headers, per discussion on llvmdev.
[oota-llvm.git] / lib / Target / Alpha / AlphaInstrInfo.cpp
index 15f5f841bc3fa8164dc0e43facdc0b977290d9eb..c2eac6c3e0e88128fcc55923c4e9bcb08641fd55 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
 #include "Alpha.h"
 #include "AlphaInstrInfo.h"
 #include "AlphaGenInstrInfo.inc"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 using namespace llvm;
 
 AlphaInstrInfo::AlphaInstrInfo()
-  : TargetInstrInfo(AlphaInsts, sizeof(AlphaInsts)/sizeof(AlphaInsts[0])),
+  : TargetInstrInfo(AlphaInsts, array_lengthof(AlphaInsts)),
     RI(*this) { }
 
 
@@ -200,6 +201,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;
 }