freebsd-dev/contrib/llvm/patches/patch-r252503-arm-transient-stack-alignment.diff
Dimitry Andric a1f8ad145e Add separate patch files for all the customizations we have currently
applied to our copy of llvm/clang.  These can be applied in alphabetical
order to a pristine llvm/clang 3.4 release source tree, to result in the
same version used in FreeBSD.

This is intended to clearly document all the changes until now, which
mostly consist of cherry pickings from the respective upstream trunks,
plus a number of hand-written FreeBSD-specific ones.  Hopefully those
can eventually be cleaned up and sent upstream too.

MFC after:	1 week
X-MFC-With:	r263313
2014-03-18 22:07:45 +00:00

80 lines
2.5 KiB
Diff

This patch applies a workaround for an ARM EABI issue, where clang would
sometimes incorrectly align the stack in a leaf function that uses TLS.
Introduced here: http://svn.freebsd.org/changeset/base/252503
Index: test/CodeGen/Thumb2/large-stack.ll
===================================================================
--- test/CodeGen/Thumb2/large-stack.ll
+++ test/CodeGen/Thumb2/large-stack.ll
@@ -13,7 +13,7 @@ define void @test1() {
define void @test2() {
; DARWIN-LABEL: test2:
; DARWIN: sub.w sp, sp, #4160
-; DARWIN: sub sp, #8
+; DARWIN: sub sp, #12
; LINUX-LABEL: test2:
; LINUX: sub.w sp, sp, #4160
; LINUX: sub sp, #8
Index: test/CodeGen/ARM/2009-10-30.ll
===================================================================
--- test/CodeGen/ARM/2009-10-30.ll
+++ test/CodeGen/ARM/2009-10-30.ll
@@ -4,9 +4,10 @@
define void @f(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, ...) {
entry:
-;CHECK: sub sp, sp, #4
-;CHECK: add r{{[0-9]+}}, sp, #8
-;CHECK: str r{{[0-9]+}}, [sp], #4
+;CHECK: sub sp, sp, #8
+;CHECK: add r{{[0-9]+}}, sp, #12
+;CHECK: str r{{[0-9]+}}, [sp, #4]
+;CHECK: add sp, sp, #8
;CHECK: bx lr
%ap = alloca i8*, align 4
%ap1 = bitcast i8** %ap to i8*
Index: test/CodeGen/ARM/vargs_align.ll
===================================================================
--- test/CodeGen/ARM/vargs_align.ll
+++ test/CodeGen/ARM/vargs_align.ll
@@ -15,8 +15,8 @@ entry:
return: ; preds = %entry
%retval2 = load i32* %retval ; <i32> [#uses=1]
ret i32 %retval2
-; EABI: add sp, sp, #12
; EABI: add sp, sp, #16
+; EABI: add sp, sp, #16
+; OABI: add sp, sp, #16
; OABI: add sp, sp, #12
-; OABI: add sp, sp, #12
}
Index: test/CodeGen/ARM/prefetch-thumb.ll
===================================================================
--- test/CodeGen/ARM/prefetch-thumb.ll
+++ test/CodeGen/ARM/prefetch-thumb.ll
@@ -10,8 +10,8 @@ entry:
;ARM: pld [sp, #50]
;THUMB2: t6:
-;THUMB2: pld [sp]
-;THUMB2: pld [sp, #50]
+;THUMB2: pld [sp, #4]
+;THUMB2: pld [sp, #54]
%red = alloca [100 x i8], align 1
%0 = getelementptr inbounds [100 x i8]* %red, i32 0, i32 0
Index: lib/Target/ARM/ARMFrameLowering.h
===================================================================
--- lib/Target/ARM/ARMFrameLowering.h
+++ lib/Target/ARM/ARMFrameLowering.h
@@ -27,7 +27,7 @@ class ARMFrameLowering : public TargetFrameLowerin
public:
explicit ARMFrameLowering(const ARMSubtarget &sti)
- : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(), 0, 4),
+ : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(), 0, 8),
STI(sti) {
}