From 9d86e26e62415a50ff9572189b67b34096c43981 Mon Sep 17 00:00:00 2001 From: Zoran Jovanovic Date: Sat, 30 Nov 2013 19:12:28 +0000 Subject: [PATCH] Fixed issue with microMIPS long branch. llvm-svn: 195975 --- llvm/lib/Target/Mips/MipsLongBranch.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/Mips/MipsLongBranch.cpp b/llvm/lib/Target/Mips/MipsLongBranch.cpp index ea8cc802835e..2efe57847add 100644 --- a/llvm/lib/Target/Mips/MipsLongBranch.cpp +++ b/llvm/lib/Target/Mips/MipsLongBranch.cpp @@ -437,8 +437,10 @@ bool MipsLongBranch::runOnMachineFunction(MachineFunction &F) { if (!I->Br || I->HasLongBranch) continue; + int ShVal = TM.getSubtarget().inMicroMipsMode() ? 2 : 4; + // Check if offset fits into 16-bit immediate field of branches. - if (!ForceLongBranch && isInt<16>(computeOffset(I->Br) / 4)) + if (!ForceLongBranch && isInt<16>(computeOffset(I->Br) / ShVal)) continue; I->HasLongBranch = true;