1 ; RUN: llc -mtriple=thumbv7-linux-gnueabi -o - %s | FileCheck %s
3 ; This alloca is just large enough that FrameLowering decides it needs a frame
4 ; to guarantee access, based on the range of ldrex.
6 ; The actual alloca size is a bit of black magic, unfortunately: the real
7 ; maximum accessible is 1020, but FrameLowering adds 16 bytes to its estimated
8 ; stack size just because so the alloca is not actually the what the limit gets
9 ; compared to. The important point is that we don't go up to ~4096, which is the
10 ; default with no strange instructions.
11 define void @test_large_frame() {
12 ; CHECK-LABEL: test_large_frame:
14 ; CHECK: sub.w sp, sp, #1008
16 %ptr = alloca i32, i32 252
18 %addr = getelementptr i32, ptr %ptr, i32 1
19 call i32 @llvm.arm.ldrex.p0(ptr elementtype(i32) %addr)
23 ; This alloca is just is just the other side of the limit, so no frame
24 define void @test_small_frame() {
25 ; CHECK-LABEL: test_small_frame:
27 ; CHECK: sub.w sp, sp, #1004
29 %ptr = alloca i32, i32 251
31 %addr = getelementptr i32, ptr %ptr, i32 1
32 call i32 @llvm.arm.ldrex.p0(ptr elementtype(i32) %addr)
36 declare i32 @llvm.arm.ldrex.p0(ptr)