aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-04-02 20:31:06 +0000
committerDale Johannesen <dalej@apple.com>2007-04-02 20:31:06 +0000
commitd959aa421a8d14fc5aad29141f816db8f4362c7f (patch)
tree742efe2ca2fcc04ef07f6f737c0a3ca6d4da3acc /lib/Target
parent6e0784da77672df0263b6291490c5df5dcadd56e (diff)
downloadexternal_llvm-d959aa421a8d14fc5aad29141f816db8f4362c7f.zip
external_llvm-d959aa421a8d14fc5aad29141f816db8f4362c7f.tar.gz
external_llvm-d959aa421a8d14fc5aad29141f816db8f4362c7f.tar.bz2
fix off by 1 error in displacement computation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35602 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 27e6cc0..efe354f 100644
--- a/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -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);
}