fix off by 1 error in displacement computation

llvm-svn: 35602
This commit is contained in:
Dale Johannesen 2007-04-02 20:31:06 +00:00
parent 8e168a4f36
commit d13786dd82
1 changed files with 5 additions and 0 deletions

View File

@ -593,6 +593,11 @@ bool ARMConstantIslands::WaterIsInRange(unsigned UserOffset,
Water->begin()->getOpcode() != ARM::CONSTPOOL_ENTRY)) Water->begin()->getOpcode() != ARM::CONSTPOOL_ENTRY))
CPEOffset += 2; 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); return OffsetIsInRange (UserOffset, CPEOffset, MaxDisp, !isThumb);
} }