111 lines · plain
1; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s -filetype=obj \2; RUN: | llvm-dwarfdump -v -debug-info - \3; RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=DWARF44; RUN: llc -O0 -mtriple=x86_64-apple-darwin < %s -filetype=obj -dwarf-version=3\5; RUN: | llvm-dwarfdump -v -debug-info - \6; RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=DWARF37 8; DWARF4: DW_AT_location [DW_FORM_sec_offset] (0x000000009; DWARF4-NEXT: {{.*}}: DW_OP_breg6 RBP-40, DW_OP_deref, DW_OP_deref10; DWARF4-NEXT: {{.*}}: DW_OP_breg0 RAX+0, DW_OP_deref11; DWARF4-NEXT: {{.*}}: DW_OP_breg6 RBP-40, DW_OP_deref, DW_OP_deref)12 13; DWARF3: DW_AT_location [DW_FORM_data4] (0x0000000014; DWARF3-NEXT: {{.*}}: DW_OP_breg6 RBP-40, DW_OP_deref, DW_OP_deref15; DWARF3-NEXT: {{.*}}: DW_OP_breg0 RAX+0, DW_OP_deref16 17; CHECK-NOT: DW_TAG18; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla")19 20; Check the DEBUG_VALUE comments for good measure.21; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK22; vla should have a register-indirect address at one point.23; ASM-CHECK: DEBUG_VALUE: vla <- [DW_OP_deref] [$rax+0]24; ASM-CHECK: DW_OP_breg625 26; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s --check-prefix=PRETTY-PRINT27; PRETTY-PRINT: DIExpression(DW_OP_deref)28 29define void @testVLAwithSize(i32 %s) nounwind uwtable ssp !dbg !5 {30entry:31 %s.addr = alloca i32, align 432 %saved_stack = alloca ptr33 %i = alloca i32, align 434 store i32 %s, ptr %s.addr, align 435 call void @llvm.dbg.declare(metadata ptr %s.addr, metadata !10, metadata !DIExpression()), !dbg !1136 %0 = load i32, ptr %s.addr, align 4, !dbg !1237 %1 = zext i32 %0 to i64, !dbg !1238 %2 = call ptr @llvm.stacksave(), !dbg !1239 store ptr %2, ptr %saved_stack, !dbg !1240 %vla = alloca i32, i64 %1, align 16, !dbg !1241 call void @llvm.dbg.declare(metadata ptr %vla, metadata !14, metadata !30), !dbg !1842 call void @llvm.dbg.declare(metadata ptr %i, metadata !19, metadata !DIExpression()), !dbg !2043 store i32 0, ptr %i, align 4, !dbg !2144 br label %for.cond, !dbg !2145 46for.cond: ; preds = %for.inc, %entry47 %3 = load i32, ptr %i, align 4, !dbg !2148 %4 = load i32, ptr %s.addr, align 4, !dbg !2149 %cmp = icmp slt i32 %3, %4, !dbg !2150 br i1 %cmp, label %for.body, label %for.end, !dbg !2151 52for.body: ; preds = %for.cond53 %5 = load i32, ptr %i, align 4, !dbg !2354 %6 = load i32, ptr %i, align 4, !dbg !2355 %mul = mul nsw i32 %5, %6, !dbg !2356 %7 = load i32, ptr %i, align 4, !dbg !2357 %idxprom = sext i32 %7 to i64, !dbg !2358 %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %idxprom, !dbg !2359 store i32 %mul, ptr %arrayidx, align 4, !dbg !2360 br label %for.inc, !dbg !2561 62for.inc: ; preds = %for.body63 %8 = load i32, ptr %i, align 4, !dbg !2664 %inc = add nsw i32 %8, 1, !dbg !2665 store i32 %inc, ptr %i, align 4, !dbg !2666 br label %for.cond, !dbg !2667 68for.end: ; preds = %for.cond69 %9 = load ptr, ptr %saved_stack, !dbg !2770 call void @llvm.stackrestore(ptr %9), !dbg !2771 ret void, !dbg !2772}73 74declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone75 76declare ptr @llvm.stacksave() nounwind77 78declare void @llvm.stackrestore(ptr) nounwind79 80!llvm.dbg.cu = !{!0}81!llvm.module.flags = !{!29}82 83!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.2 (trunk 156005) (llvm/trunk 156000)", isOptimized: false, emissionKind: FullDebug, file: !28, enums: !1, retainedTypes: !1, globals: !1, imports: !1)84!1 = !{}85!5 = distinct !DISubprogram(name: "testVLAwithSize", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !28, scope: !6, type: !7, retainedNodes: !1)86!6 = !DIFile(filename: "bar.c", directory: "/Users/echristo/tmp")87!7 = !DISubroutineType(types: !8)88!8 = !{null, !9}89!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)90!10 = !DILocalVariable(name: "s", line: 1, arg: 1, scope: !5, file: !6, type: !9)91!11 = !DILocation(line: 1, column: 26, scope: !5)92!12 = !DILocation(line: 3, column: 13, scope: !13)93!13 = distinct !DILexicalBlock(line: 2, column: 1, file: !28, scope: !5)94!14 = !DILocalVariable(name: "vla", line: 3, scope: !13, file: !6, type: !15)95!15 = !DICompositeType(tag: DW_TAG_array_type, align: 32, baseType: !9, elements: !16)96!16 = !{!17}97!17 = !DISubrange(count: -1)98!18 = !DILocation(line: 3, column: 7, scope: !13)99!19 = !DILocalVariable(name: "i", line: 4, scope: !13, file: !6, type: !9)100!20 = !DILocation(line: 4, column: 7, scope: !13)101!21 = !DILocation(line: 5, column: 8, scope: !22)102!22 = distinct !DILexicalBlock(line: 5, column: 3, file: !28, scope: !13)103!23 = !DILocation(line: 6, column: 5, scope: !24)104!24 = distinct !DILexicalBlock(line: 5, column: 27, file: !28, scope: !22)105!25 = !DILocation(line: 7, column: 3, scope: !24)106!26 = !DILocation(line: 5, column: 22, scope: !22)107!27 = !DILocation(line: 8, column: 1, scope: !13)108!28 = !DIFile(filename: "bar.c", directory: "/Users/echristo/tmp")109!29 = !{i32 1, !"Debug Info Version", i32 3}110!30 = !DIExpression(DW_OP_deref)111