ARM: correctly align constant pool value on Thumb1 targets.

Since we're using tLDRpci to access it, the constant pool's address must be 0
(mod 4).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249163 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tim Northover 2015-10-02 18:07:13 +00:00
parent 64bfc0ae9d
commit 6e8613fb75
2 changed files with 15 additions and 11 deletions

View File

@ -1968,7 +1968,7 @@ void ARMFrameLowering::adjustForSegmentedStacks(
ARMConstantPoolValue *NewCPV = ARMConstantPoolSymbol::Create(
MF.getFunction()->getContext(), "__STACK_LIMIT", PCLabelId, 0);
MachineConstantPool *MCP = MF.getConstantPool();
unsigned CPI = MCP->getConstantPoolIndex(NewCPV, MF.getAlignment());
unsigned CPI = MCP->getConstantPoolIndex(NewCPV, 4);
// ldr SR0, [pc, offset(STACK_LIMIT)]
AddDefaultPred(BuildMI(GetMBB, DL, TII.get(ARM::tLDRpci), ScratchReg0)

View File

@ -12,7 +12,7 @@ define void @test_basic() #0 {
call void @dummy_use (i32* %mem, i32 10)
ret void
; Thumb-android: test_basic:
; Thumb-android-LABEL: test_basic:
; Thumb-android: push {r4, r5}
; Thumb-android-NEXT: mov r5, sp
@ -32,7 +32,11 @@ define void @test_basic() #0 {
; Thumb-android: pop {r4, r5}
; Thumb-linux: test_basic:
; Thumb-android: .align 2
; Thumb-android: .LCPI0_0:
; Thumb-android-NEXT: .long __STACK_LIMIT
; Thumb-linux-LABEL: test_basic:
; Thumb-linux: push {r4, r5}
; Thumb-linux-NEXT: mov r5, sp
@ -61,7 +65,7 @@ define i32 @test_nested(i32 * nest %closure, i32 %other) #0 {
call void @dummy_use (i32* %mem, i32 10)
ret i32 %result
; Thumb-android: test_nested:
; Thumb-android-LABEL: test_nested:
; Thumb-android: push {r4, r5}
; Thumb-android-NEXT: mov r5, sp
@ -81,7 +85,7 @@ define i32 @test_nested(i32 * nest %closure, i32 %other) #0 {
; Thumb-android: pop {r4, r5}
; Thumb-linux: test_nested:
; Thumb-linux-LABEL: test_nested:
; Thumb-linux: push {r4, r5}
; Thumb-linux-NEXT: mov r5, sp
@ -108,7 +112,7 @@ define void @test_large() #0 {
call void @dummy_use (i32* %mem, i32 0)
ret void
; Thumb-android: test_large:
; Thumb-android-LABEL: test_large:
; Thumb-android: push {r4, r5}
; Thumb-android-NEXT: mov r5, sp
@ -129,7 +133,7 @@ define void @test_large() #0 {
; Thumb-android: pop {r4, r5}
; Thumb-linux: test_large:
; Thumb-linux-LABEL: test_large:
; Thumb-linux: push {r4, r5}
; Thumb-linux-NEXT: mov r5, sp
@ -157,7 +161,7 @@ define fastcc void @test_fastcc() #0 {
call void @dummy_use (i32* %mem, i32 10)
ret void
; Thumb-android: test_fastcc:
; Thumb-android-LABEL: test_fastcc:
; Thumb-android: push {r4, r5}
; Thumb-android-NEXT: mov r5, sp
@ -177,7 +181,7 @@ define fastcc void @test_fastcc() #0 {
; Thumb-android: pop {r4, r5}
; Thumb-linux: test_fastcc:
; Thumb-linux-LABEL: test_fastcc:
; Thumb-linux: push {r4, r5}
; Thumb-linux-NEXT: mov r5, sp
@ -204,7 +208,7 @@ define fastcc void @test_fastcc_large() #0 {
call void @dummy_use (i32* %mem, i32 0)
ret void
; Thumb-android: test_fastcc_large:
; Thumb-android-LABEL: test_fastcc_large:
; Thumb-android: push {r4, r5}
; Thumb-android-NEXT: mov r5, sp
@ -225,7 +229,7 @@ define fastcc void @test_fastcc_large() #0 {
; Thumb-android: pop {r4, r5}
; Thumb-linux: test_fastcc_large:
; Thumb-linux-LABEL: test_fastcc_large:
; Thumb-linux: push {r4, r5}
; Thumb-linux-NEXT: mov r5, sp