tbb / tbh instructions only branch forward, not backwards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77522 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index aad5eb7..bc9e11b 100644
--- a/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -1358,10 +1358,12 @@
for (unsigned j = 0, ee = JTBBs.size(); j != ee; ++j) {
MachineBasicBlock *MBB = JTBBs[j];
unsigned DstOffset = BBOffsets[MBB->getNumber()];
- if (ByteOk && !OffsetIsInRange(JTOffset, DstOffset, (1<<8)-1, true, false))
+ // Negative offset is not ok. FIXME: We should change BB layout to make
+ // sure all the branches are forward.
+ if (ByteOk && !OffsetIsInRange(JTOffset, DstOffset, (1<<8)-1, false))
ByteOk = false;
if (HalfWordOk &&
- !OffsetIsInRange(JTOffset, DstOffset, (1<<16)-1, true, false))
+ !OffsetIsInRange(JTOffset, DstOffset, (1<<16)-1, false))
HalfWordOk = false;
if (!ByteOk && !HalfWordOk)
break;