blob: 5eccc65f2dec22e110627651cf2403a51fcc0bd5 [file] [log] [blame]
Etienne Bergeron22bfa832016-06-07 20:15:35 +00001
2; RUN: llc -mtriple=i386-pc-windows-msvc < %s -o - | FileCheck -check-prefix=MSVC-I386 %s
3; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s -o - | FileCheck -check-prefix=MSVC-64 %s
4
5; MSVC-I386: movl ___security_cookie, %[[REG1:[a-z]*]]
6; MSVC-I386: movl %[[REG1]], [[SLOT:[0-9]*]](%esp)
7; MSVC-I386: calll _strcpy
8; MSVC-I386: movl [[SLOT]](%esp), %ecx
9; MSVC-I386: calll @__security_check_cookie@4
10; MSVC-I386: retl
11
12; MSVC-64: movq __security_cookie(%rip), %[[REG1:[a-z]*]]
13; MSVC-64: movq %[[REG1]], [[SLOT:[0-9]*]](%rsp)
14; MSVC-64: callq strcpy
15; MSVC-64: movq [[SLOT]](%rsp), %rcx
16; MSVC-64: callq __security_check_cookie
17
18@"\01LC" = internal constant [11 x i8] c"buf == %s\0A\00" ; <[11 x i8]*> [#uses=1]
19
20define void @test(i8* %a) nounwind ssp {
21entry:
22 %a_addr = alloca i8* ; <i8**> [#uses=2]
23 %buf = alloca [8 x i8] ; <[8 x i8]*> [#uses=2]
24 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
25 store i8* %a, i8** %a_addr
26 %buf1 = bitcast [8 x i8]* %buf to i8* ; <i8*> [#uses=1]
27 %0 = load i8*, i8** %a_addr, align 4 ; <i8*> [#uses=1]
28 %1 = call i8* @strcpy(i8* %buf1, i8* %0) nounwind ; <i8*> [#uses=0]
29 %buf2 = bitcast [8 x i8]* %buf to i8* ; <i8*> [#uses=1]
30 %2 = call i32 (i8*, ...) @printf(i8* getelementptr ([11 x i8], [11 x i8]* @"\01LC", i32 0, i32 0), i8* %buf2) nounwind ; <i32> [#uses=0]
31 br label %return
32
33return: ; preds = %entry
34 ret void
35}
36
37declare i8* @strcpy(i8*, i8*) nounwind
38
39declare i32 @printf(i8*, ...) nounwind
40