1 ; RUN: llc < %s | FileCheck %s 2 3 ; C source: 4 ; void escape(int *); 5 ; int ssp(int a) { 6 ; int arr[4] = {a, a, a, a}; 7 ; escape(&arr[0]); 8 ; return a; 9 ; } 10 11 ; CHECK: _ssp: # @ssp 12 ; CHECK: .cv_fpo_proc _ssp 4 13 ; CHECK: pushl %esi 14 ; CHECK: .cv_fpo_pushreg %esi 15 ; CHECK: subl $20, %esp 16 ; CHECK: .cv_fpo_stackalloc 20 17 ; CHECK: .cv_fpo_endprologue 18 ; CHECK: ___security_cookie 19 20 ; CHECK: movl 28(%esp), %esi 21 ; CHECK: movl %esi, {{[0-9]*}}(%esp) 22 ; CHECK: movl %esi, {{[0-9]*}}(%esp) 23 ; CHECK: movl %esi, {{[0-9]*}}(%esp) 24 ; CHECK: movl %esi, {{[0-9]*}}(%esp) 25 26 ; CHECK: calll _escape 27 ; CHECK: calll @__security_check_cookie@4 28 29 ; CHECK: movl %esi, %eax 30 ; CHECK: addl $20, %esp 31 ; CHECK: popl %esi 32 ; CHECK: retl 33 ; CHECK: Ltmp2: 34 ; CHECK: .cv_fpo_endproc 35 36 ; ModuleID = 't.c' 37 source_filename = "t.c" 38 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 39 target triple = "i386-pc-windows-msvc19.11.25508" 40 41 ; Function Attrs: nounwind sspstrong 42 define i32 @ssp(i32 returned %a) local_unnamed_addr #0 !dbg !8 { 43 entry: 44 %arr = alloca [4 x i32], align 4 45 tail call void @llvm.dbg.value(metadata i32 %a, metadata !13, metadata !DIExpression()), !dbg !18 46 %0 = bitcast [4 x i32]* %arr to i8*, !dbg !19 47 call void @llvm.lifetime.start.p0i8(i64 16, i8* nonnull %0) #4, !dbg !19 48 tail call void @llvm.dbg.declare(metadata [4 x i32]* %arr, metadata !14, metadata !DIExpression()), !dbg !20 49 %arrayinit.begin = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i32 0, i32 0, !dbg !21 50 store i32 %a, i32* %arrayinit.begin, align 4, !dbg !21, !tbaa !22 51 %arrayinit.element = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i32 0, i32 1, !dbg !21 52 store i32 %a, i32* %arrayinit.element, align 4, !dbg !21, !tbaa !22 53 %arrayinit.element1 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i32 0, i32 2, !dbg !21 54 store i32 %a, i32* %arrayinit.element1, align 4, !dbg !21, !tbaa !22 55 %arrayinit.element2 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i32 0, i32 3, !dbg !21 56 store i32 %a, i32* %arrayinit.element2, align 4, !dbg !21, !tbaa !22 57 call void @escape(i32* nonnull %arrayinit.begin) #4, !dbg !26 58 call void @llvm.lifetime.end.p0i8(i64 16, i8* nonnull %0) #4, !dbg !27 59 ret i32 %a, !dbg !28 60 } 61 62 ; Function Attrs: nounwind readnone speculatable 63 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 64 65 ; Function Attrs: argmemonly nounwind 66 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #2 67 68 declare void @escape(i32*) local_unnamed_addr #3 69 70 ; Function Attrs: argmemonly nounwind 71 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #2 72 73 ; Function Attrs: nounwind readnone speculatable 74 declare void @llvm.dbg.value(metadata, metadata, metadata) #1 75 76 attributes #0 = { nounwind sspstrong "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 77 attributes #1 = { nounwind readnone speculatable } 78 attributes #2 = { argmemonly nounwind } 79 attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 80 attributes #4 = { nounwind } 81 82 !llvm.dbg.cu = !{!0} 83 !llvm.module.flags = !{!3, !4, !5, !6} 84 !llvm.ident = !{!7} 85 86 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 87 !1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "df0c1a43acd19a1255d45a3f2802cf9f") 88 !2 = !{} 89 !3 = !{i32 1, !"NumRegisterParameters", i32 0} 90 !4 = !{i32 2, !"CodeView", i32 1} 91 !5 = !{i32 2, !"Debug Info Version", i32 3} 92 !6 = !{i32 1, !"wchar_size", i32 2} 93 !7 = !{!"clang version 6.0.0 "} 94 !8 = distinct !DISubprogram(name: "ssp", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) 95 !9 = !DISubroutineType(types: !10) 96 !10 = !{!11, !11} 97 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 98 !12 = !{!13, !14} 99 !13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11) 100 !14 = !DILocalVariable(name: "arr", scope: !8, file: !1, line: 3, type: !15) 101 !15 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 128, elements: !16) 102 !16 = !{!17} 103 !17 = !DISubrange(count: 4) 104 !18 = !DILocation(line: 2, column: 13, scope: !8) 105 !19 = !DILocation(line: 3, column: 3, scope: !8) 106 !20 = !DILocation(line: 3, column: 7, scope: !8) 107 !21 = !DILocation(line: 3, column: 16, scope: !8) 108 !22 = !{!23, !23, i64 0} 109 !23 = !{!"int", !24, i64 0} 110 !24 = !{!"omnipotent char", !25, i64 0} 111 !25 = !{!"Simple C/C++ TBAA"} 112 !26 = !DILocation(line: 4, column: 3, scope: !8) 113 !27 = !DILocation(line: 6, column: 1, scope: !8) 114 !28 = !DILocation(line: 5, column: 3, scope: !8) 115