blob: 9fefeca92e5a7a87f1524001732207fb58ae5570 [file] [log] [blame]
Paul Robinson05efe0f2019-03-06 19:57:43 +00001; Verify that a ud2 is generated after the call to __stack_chk_fail.
2
3; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=false -O0 -o - | FileCheck %s
4; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=false -O2 -o - | FileCheck %s
5; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=true -O0 -o - | FileCheck %s
6; RUN: llc < %s -mtriple=x86_64-scei-ps4 -enable-selectiondag-sp=true -O2 -o - | FileCheck %s
7
8
9; CHECK: check_input:
10; CHECK: callq __stack_chk_fail
11; CHECK-NEXT: ud2
12; CHECK: .size check_input
13; CHECK-NEXT: .cfi_endproc
14
15@.str = private unnamed_addr constant [37 x i8] c"????????????????????????????????????\00", align 1
16
17define signext i8 @check_input(i8* %input) nounwind uwtable ssp {
18entry:
19 %input.addr = alloca i8*, align 8
20 %buf = alloca [16 x i8], align 16
21 store i8* %input, i8** %input.addr, align 8
22 %arraydecay = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0
23 %0 = load i8*, i8** %input.addr, align 8
24 %call = call i8* @strcpy(i8* %arraydecay, i8* %0) nounwind
25 %arrayidx = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i64 0
26 %1 = load i8, i8* %arrayidx, align 1
27 ret i8 %1
28}
29
30declare i8* @strcpy(i8*, i8*) nounwind
31
32define i32 @main() nounwind uwtable ssp {
33entry:
34 %retval = alloca i32, align 4
35 store i32 0, i32* %retval
36 %call = call signext i8 @check_input(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i32 0, i32 0))
37 %conv = sext i8 %call to i32
38 ret i32 %conv
39}