1 ; RUN: llc -march=hexagon -mcpu=hexagonv55 -enable-stackovf-sanitizer < %s | FileCheck %s 2 3 ; CHECK-LABEL: foo_1 4 ; CHECK: __runtime_stack_check 5 define i32 @foo_1(i32 %n) #0 { 6 entry: 7 %local = alloca [1024 x i32], align 8 8 %0 = bitcast [1024 x i32]* %local to i8* 9 call void @llvm.lifetime.start(i64 4096, i8* %0) #1 10 %arraydecay = getelementptr inbounds [1024 x i32], [1024 x i32]* %local, i32 0, i32 0 11 call void @baz_1(i32* %arraydecay) #3 12 %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* %local, i32 0, i32 %n 13 %1 = load i32, i32* %arrayidx, align 4 14 call void @llvm.lifetime.end(i64 4096, i8* %0) #1 15 ret i32 %1 16 } 17 18 ; CHECK-LABEL: foo_2 19 ; CHECK: __save_r16_through_r19_stkchk 20 define i32 @foo_2(i32 %n, i32* %y) #0 { 21 entry: 22 %local = alloca [2048 x i32], align 8 23 %0 = bitcast [2048 x i32]* %local to i8* 24 call void @llvm.lifetime.start(i64 8192, i8* %0) #1 25 %arraydecay = getelementptr inbounds [2048 x i32], [2048 x i32]* %local, i32 0, i32 0 26 call void @baz_2(i32* %y, i32* %arraydecay) #3 27 %1 = load i32, i32* %y, align 4 28 %add = add nsw i32 %n, %1 29 %arrayidx = getelementptr inbounds [2048 x i32], [2048 x i32]* %local, i32 0, i32 %add 30 %2 = load i32, i32* %arrayidx, align 4 31 call void @llvm.lifetime.end(i64 8192, i8* %0) #1 32 ret i32 %2 33 } 34 35 declare void @baz_1(i32*) #2 36 declare void @baz_2(i32*, i32*) #2 37 declare void @llvm.lifetime.start(i64, i8* nocapture) #1 38 declare void @llvm.lifetime.end(i64, i8* nocapture) #1 39 40 attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 41 attributes #1 = { nounwind } 42 attributes #2 = { optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 43 attributes #3 = { optsize } 44 45