[ARM] Fix offset calculation in ARMBaseRegisterInfo::needsFrameBaseReg

The input offset to needsFrameBaseReg is a negative value below the top of the
stack frame, but when converting to a positive offset from the bottom of the
stack frame this value was negated, causing the final offset to be too large
by twice the input offset's magnitude. Fix that by not negating the offset.

Patch by John Brawn

Differential Revision: http://reviews.llvm.org/D8316

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Barton
2015-03-17 18:20:47 +00:00
parent de3983775e
commit b59aee170f
3 changed files with 35 additions and 26 deletions

View File

@@ -72,3 +72,19 @@ define zeroext i16 @test6() {
%1 = load i16, i16* %x, align 2
ret i16 %1
}
; Accessing the bottom of a large array shouldn't require materializing a base
define void @test7() {
%arr = alloca [200 x i32], align 4
; CHECK: movs [[REG:r[0-9]+]], #1
; CHECK: str [[REG]], [sp, #4]
%arrayidx = getelementptr inbounds [200 x i32], [200 x i32]* %arr, i32 0, i32 1
store i32 1, i32* %arrayidx, align 4
; CHECK: str [[REG]], [sp, #16]
%arrayidx1 = getelementptr inbounds [200 x i32], [200 x i32]* %arr, i32 0, i32 4
store i32 1, i32* %arrayidx1, align 4
ret void
}