[mips] Disable tail merging when long branch pass is enabled.
authorAkira Hatanaka <ahatanaka@mips.com>
Mon, 7 Oct 2013 19:13:53 +0000 (19:13 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Mon, 7 Oct 2013 19:13:53 +0000 (19:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192124 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsTargetMachine.cpp

index 06f78e0ab36769f41b89103f86ea455d5ef382e8..5046c1b782f66d11abf843e36110f10395ed59e2 100644 (file)
@@ -135,7 +135,13 @@ namespace {
 class MipsPassConfig : public TargetPassConfig {
 public:
   MipsPassConfig(MipsTargetMachine *TM, PassManagerBase &PM)
-    : TargetPassConfig(TM, PM) {}
+    : TargetPassConfig(TM, PM) {
+    // The current implementation of long branch pass requires a scratch
+    // register ($at) to be available before branch instructions. Tail merging
+    // can break this requirement, so disable it when long branch pass is
+    // enabled.
+    EnableTailMerge = !getMipsSubtarget().enableLongBranchPass();
+  }
 
   MipsTargetMachine &getMipsTargetMachine() const {
     return getTM<MipsTargetMachine>();