[llvm] r249163 - ARM: correctly align constant pool value on Thumb1 targets.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 11:07:13 PDT 2015
Author: tnorthover
Date: Fri Oct 2 13:07:13 2015
New Revision: 249163
URL: http://llvm.org/viewvc/llvm-project?rev=249163&view=rev
Log:
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).
Modified:
llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
llvm/trunk/test/CodeGen/Thumb/segmented-stacks.ll
Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=249163&r1=249162&r2=249163&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Fri Oct 2 13:07:13 2015
@@ -1968,7 +1968,7 @@ void ARMFrameLowering::adjustForSegmente
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)
Modified: llvm/trunk/test/CodeGen/Thumb/segmented-stacks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/segmented-stacks.ll?rev=249163&r1=249162&r2=249163&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb/segmented-stacks.ll (original)
+++ llvm/trunk/test/CodeGen/Thumb/segmented-stacks.ll Fri Oct 2 13:07:13 2015
@@ -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 %clos
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 %clos
; 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()
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()
; 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
More information about the llvm-commits
mailing list