1 ; This test is attempting to detect that the compiler correctly generates stack 2 ; probe calls when the size of the local variables exceeds the specified stack 3 ; probe size. 4 ; 5 ; Testing the default value of 4096 bytes makes sense, because the default 6 ; stack probe size equals the page size (4096 bytes for all x86 targets), and 7 ; this is unlikely to change in the future. 8 ; 9 ; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s 10 11 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" 12 13 define i32 @test1() "stack-probe-size"="0" { 14 %buffer = alloca [4095 x i8] 15 16 ret i32 0 17 18 ; CHECK-LABEL: _test1: 19 ; CHECK-NOT: subl $4095, %esp 20 ; CHECK: movl $4095, %eax 21 ; CHECK: calll __chkstk 22 } 23 24 define i32 @test2() { 25 %buffer = alloca [4095 x i8] 26 27 ret i32 0 28 29 ; CHECK-LABEL: _test2: 30 ; CHECK-NOT: movl $4095, %eax 31 ; CHECK: subl $4095, %esp 32 ; CHECK-NOT: calll __chkstk 33 } 34 35 define i32 @test3() "stack-probe-size"="8192" { 36 %buffer = alloca [4095 x i8] 37 38 ret i32 0 39 40 ; CHECK-LABEL: _test3: 41 ; CHECK-NOT: movl $4095, %eax 42 ; CHECK: subl $4095, %esp 43 ; CHECK-NOT: calll __chkstk 44 } 45 46 define i32 @test4() "stack-probe-size"="0" { 47 %buffer = alloca [4096 x i8] 48 49 ret i32 0 50 51 ; CHECK-LABEL: _test4: 52 ; CHECK-NOT: subl $4096, %esp 53 ; CHECK: movl $4096, %eax 54 ; CHECK: calll __chkstk 55 } 56 57 define i32 @test5() { 58 %buffer = alloca [4096 x i8] 59 60 ret i32 0 61 62 ; CHECK-LABEL: _test5: 63 ; CHECK-NOT: subl $4096, %esp 64 ; CHECK: movl $4096, %eax 65 ; CHECK: calll __chkstk 66 } 67 68 define i32 @test6() "stack-probe-size"="8192" { 69 %buffer = alloca [4096 x i8] 70 71 ret i32 0 72 73 ; CGECK-LABEL: _test6: 74 ; CGECK-NOT: movl $4096, %eax 75 ; CGECK: subl $4096, %esp 76 ; CGECK-NOT: calll __chkstk 77 } 78