From 5954578b3c80016d3ebb292374c0365745b66e63 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Mon, 7 Oct 2013 19:13:53 +0000 Subject: [PATCH] [mips] Disable tail merging when long branch pass is enabled. llvm-svn: 192124 --- lib/Target/Mips/MipsTargetMachine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index 06f78e0ab36..5046c1b782f 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -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();