From: Dale Johannesen Date: Mon, 2 Apr 2007 20:31:06 +0000 (+0000) Subject: fix off by 1 error in displacement computation X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d959aa421a8d14fc5aad29141f816db8f4362c7f;p=oota-llvm.git 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 --- diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index 27e6cc08a39..efe354f63d9 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); }