116 lines · plain
1; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck %s2 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: # @ssp12; CHECK: .cv_fpo_proc _ssp 413; CHECK: pushl %esi14; CHECK: .cv_fpo_pushreg %esi15; CHECK: subl $20, %esp16; CHECK: .cv_fpo_stackalloc 2017; CHECK: .cv_fpo_endprologue18; CHECK: movl ___security_cookie, %ea19 20; CHECK: movl 28(%esp), %esi21; 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 _escape27 28; CHECK: movl ___security_cookie, %ecx29; CHECK: cmpl %eax, %ecx30 31; CHECK: movl %esi, %eax32; CHECK: addl $20, %esp33; CHECK: popl %esi34; CHECK: retl35; CHECK: Ltmp4:36; CHECK: calll @__security_check_cookie@437; CHECK: .cv_fpo_endproc38 39; ModuleID = 't.c'40source_filename = "t.c"41target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"42target triple = "i386-pc-windows-msvc19.11.25508"43 44; Function Attrs: nounwind sspstrong45define i32 @ssp(i32 returned %a) local_unnamed_addr #0 !dbg !8 {46entry:47 %arr = alloca [4 x i32], align 448 tail call void @llvm.dbg.value(metadata i32 %a, metadata !13, metadata !DIExpression()), !dbg !1849 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %arr) #4, !dbg !1950 tail call void @llvm.dbg.declare(metadata ptr %arr, metadata !14, metadata !DIExpression()), !dbg !2051 store i32 %a, ptr %arr, align 4, !dbg !21, !tbaa !2252 %arrayinit.element = getelementptr inbounds [4 x i32], ptr %arr, i32 0, i32 1, !dbg !2153 store i32 %a, ptr %arrayinit.element, align 4, !dbg !21, !tbaa !2254 %arrayinit.element1 = getelementptr inbounds [4 x i32], ptr %arr, i32 0, i32 2, !dbg !2155 store i32 %a, ptr %arrayinit.element1, align 4, !dbg !21, !tbaa !2256 %arrayinit.element2 = getelementptr inbounds [4 x i32], ptr %arr, i32 0, i32 3, !dbg !2157 store i32 %a, ptr %arrayinit.element2, align 4, !dbg !21, !tbaa !2258 call void @escape(ptr nonnull %arr) #4, !dbg !2659 call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %arr) #4, !dbg !2760 ret i32 %a, !dbg !2861}62 63; Function Attrs: nounwind readnone speculatable64declare void @llvm.dbg.declare(metadata, metadata, metadata) #165 66; Function Attrs: argmemonly nounwind67declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #268 69declare void @escape(ptr) local_unnamed_addr #370 71; Function Attrs: argmemonly nounwind72declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #273 74; Function Attrs: nounwind readnone speculatable75declare void @llvm.dbg.value(metadata, metadata, metadata) #176 77attributes #0 = { nounwind sspstrong "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" "use-soft-float"="false" }78attributes #1 = { nounwind readnone speculatable }79attributes #2 = { argmemonly nounwind }80attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" "use-soft-float"="false" }81attributes #4 = { nounwind }82 83!llvm.dbg.cu = !{!0}84!llvm.module.flags = !{!3, !4, !5, !6}85!llvm.ident = !{!7}86 87!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)88!1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "df0c1a43acd19a1255d45a3f2802cf9f")89!2 = !{}90!3 = !{i32 1, !"NumRegisterParameters", i32 0}91!4 = !{i32 2, !"CodeView", i32 1}92!5 = !{i32 2, !"Debug Info Version", i32 3}93!6 = !{i32 1, !"wchar_size", i32 2}94!7 = !{!"clang version 6.0.0 "}95!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)96!9 = !DISubroutineType(types: !10)97!10 = !{!11, !11}98!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)99!12 = !{!13, !14}100!13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)101!14 = !DILocalVariable(name: "arr", scope: !8, file: !1, line: 3, type: !15)102!15 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 128, elements: !16)103!16 = !{!17}104!17 = !DISubrange(count: 4)105!18 = !DILocation(line: 2, column: 13, scope: !8)106!19 = !DILocation(line: 3, column: 3, scope: !8)107!20 = !DILocation(line: 3, column: 7, scope: !8)108!21 = !DILocation(line: 3, column: 16, scope: !8)109!22 = !{!23, !23, i64 0}110!23 = !{!"int", !24, i64 0}111!24 = !{!"omnipotent char", !25, i64 0}112!25 = !{!"Simple C/C++ TBAA"}113!26 = !DILocation(line: 4, column: 3, scope: !8)114!27 = !DILocation(line: 6, column: 1, scope: !8)115!28 = !DILocation(line: 5, column: 3, scope: !8)116