2010-04-15 18:42:28 +00:00
|
|
|
; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -O3 | FileCheck %s
|
|
|
|
; rdar://7493908
|
|
|
|
|
|
|
|
; Make sure the result of the first dynamic_alloc isn't copied back to sp more
|
|
|
|
; than once. We'll deal with poor codegen later.
|
|
|
|
|
2010-06-17 15:18:27 +00:00
|
|
|
define void @t() nounwind ssp {
|
2010-04-15 18:42:28 +00:00
|
|
|
entry:
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: t:
|
2010-09-03 18:37:12 +00:00
|
|
|
%size = mul i32 8, 2
|
Many Thumb2 instructions can reference the full ARM register set (i.e.,
have 4 bits per register in the operand encoding), but have undefined
behavior when the operand value is 13 or 15 (SP and PC, respectively).
The trivial coalescer in linear scan sometimes will merge a copy from
SP into a subsequent instruction which uses the copy, and if that
instruction cannot legally reference SP, we get bad code such as:
mls r0,r9,r0,sp
instead of:
mov r2, sp
mls r0, r9, r0, r2
This patch adds a new register class for use by Thumb2 that excludes
the problematic registers (SP and PC) and is used instead of GPR
for those operands which cannot legally reference PC or SP. The
trivial coalescer explicitly requires that the register class
of the destination for the COPY instruction contain the source
register for the COPY to be considered for coalescing. This prevents
errant instructions like that above.
PR7499
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 02:41:01 +00:00
|
|
|
; CHECK: subs r0, #16
|
|
|
|
; CHECK: mov sp, r0
|
2010-09-03 18:37:12 +00:00
|
|
|
%vla_a = alloca i8, i32 %size, align 8
|
Many Thumb2 instructions can reference the full ARM register set (i.e.,
have 4 bits per register in the operand encoding), but have undefined
behavior when the operand value is 13 or 15 (SP and PC, respectively).
The trivial coalescer in linear scan sometimes will merge a copy from
SP into a subsequent instruction which uses the copy, and if that
instruction cannot legally reference SP, we get bad code such as:
mls r0,r9,r0,sp
instead of:
mov r2, sp
mls r0, r9, r0, r2
This patch adds a new register class for use by Thumb2 that excludes
the problematic registers (SP and PC) and is used instead of GPR
for those operands which cannot legally reference PC or SP. The
trivial coalescer explicitly requires that the register class
of the destination for the COPY instruction contain the source
register for the COPY to be considered for coalescing. This prevents
errant instructions like that above.
PR7499
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-30 02:41:01 +00:00
|
|
|
; CHECK: subs r0, #16
|
|
|
|
; CHECK: mov sp, r0
|
2010-04-15 18:42:28 +00:00
|
|
|
%vla_b = alloca i8, i32 %size, align 8
|
|
|
|
unreachable
|
|
|
|
}
|