1; RUN: llc -mtriple=thumbv7-linux-gnueabi -o - %s | FileCheck %s 2 3; This alloca is just large enough that FrameLowering decides it needs a frame 4; to guarantee access, based on the range of ldrex. 5 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. 11define void @test_large_frame() { 12; CHECK-LABEL: test_large_frame: 13; CHECK: push 14; CHECK: sub.w sp, sp, #1008 15 16 %ptr = alloca i32, i32 252 17 18 %addr = getelementptr i32, i32* %ptr, i32 1 19 call i32 @llvm.arm.ldrex.p0i32(i32* %addr) 20 ret void 21} 22 23; This alloca is just is just the other side of the limit, so no frame 24define void @test_small_frame() { 25; CHECK-LABEL: test_small_frame: 26; CHECK-NOT: push 27; CHECK: sub.w sp, sp, #1004 28 29 %ptr = alloca i32, i32 251 30 31 %addr = getelementptr i32, i32* %ptr, i32 1 32 call i32 @llvm.arm.ldrex.p0i32(i32* %addr) 33 ret void 34} 35 36declare i32 @llvm.arm.ldrex.p0i32(i32*) 37