fix off by 1 error in displacement computation
authorDale Johannesen <dalej@apple.com>
Mon, 2 Apr 2007 20:31:06 +0000 (20:31 +0000)
committerDale Johannesen <dalej@apple.com>
Mon, 2 Apr 2007 20:31:06 +0000 (20:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35602 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMConstantIslandPass.cpp

index 27e6cc08a3934b028ba537314cc45a46c24f01c3..efe354f63d97e2aef43f9e850e263dd85ea5e74f 100644 (file)
@@ -593,6 +593,11 @@ bool ARMConstantIslands::WaterIsInRange(unsigned UserOffset,
        Water->begin()->getOpcode() != ARM::CONSTPOOL_ENTRY))
     CPEOffset += 2;
 
+  // If the CPE is to be inserted before the instruction, that will raise
+  // the offset of the instruction.
+  if (CPEOffset < UserOffset)
+    UserOffset += isThumb ? 2 : 4;
+
   return OffsetIsInRange (UserOffset, CPEOffset, MaxDisp, !isThumb);
 }