1; RUN: llc -mtriple=mips -mcpu=mips32r2 -O0 -filetype=obj -fast-isel=0 <%s | \ 2; RUN: llvm-dwarfdump -v -all - | FileCheck %s 3 4declare void @llvm.dbg.declare(metadata, metadata, metadata) 5 6declare void @foo(ptr) 7 8; void foo(int *); 9; 10; int f2(int a, int b) { 11; int c __attribute__((aligned(16))) = a + b; 12; foo(&c); 13; return c; 14; } 15; 16; int *f3(int a, int b) { 17; int c __attribute__((aligned(16))) = a + b; 18; int *w = alloca(c); 19; foo(&c); 20; return w; 21; } 22 23; CHECK: DW_TAG_subprogram 24; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_breg29 SP_64+36) 25; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "c") 26 27; Function Attrs: nounwind 28define i32 @f2(i32 signext %a, i32 signext %b) !dbg !4 { 29entry: 30 %a.addr = alloca i32, align 4 31 %b.addr = alloca i32, align 4 32 %c = alloca i32, align 16 33 store i32 %a, ptr %a.addr, align 4 34 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !15, metadata !16), !dbg !17 35 store i32 %b, ptr %b.addr, align 4 36 call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !18, metadata !16), !dbg !19 37 call void @llvm.dbg.declare(metadata ptr %c, metadata !20, metadata !16), !dbg !21 38 %0 = load i32, ptr %a.addr, align 4, !dbg !22 39 %1 = load i32, ptr %b.addr, align 4, !dbg !23 40 %add = add nsw i32 %0, %1, !dbg !24 41 store i32 %add, ptr %c, align 16, !dbg !21 42 call void @foo(ptr %c), !dbg !25 43 %2 = load i32, ptr %c, align 16, !dbg !26 44 ret i32 %2, !dbg !27 45} 46 47; CHECK: DW_TAG_subprogram 48; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_breg23 S7_64+32) 49; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "c") 50 51define ptr @f3(i32 signext %a, i32 signext %b) !dbg !8 { 52entry: 53 %a.addr = alloca i32, align 4 54 %b.addr = alloca i32, align 4 55 %c = alloca i32, align 16 56 %w = alloca ptr, align 4 57 store i32 %a, ptr %a.addr, align 4 58 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !28, metadata !16), !dbg !29 59 store i32 %b, ptr %b.addr, align 4 60 call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !30, metadata !16), !dbg !31 61 call void @llvm.dbg.declare(metadata ptr %c, metadata !32, metadata !16), !dbg !33 62 %0 = load i32, ptr %a.addr, align 4, !dbg !34 63 %1 = load i32, ptr %b.addr, align 4, !dbg !35 64 %add = add nsw i32 %0, %1, !dbg !36 65 store i32 %add, ptr %c, align 16, !dbg !33 66 call void @llvm.dbg.declare(metadata ptr %w, metadata !37, metadata !DIExpression(DW_OP_deref)), !dbg !38 67 %2 = load i32, ptr %c, align 16, !dbg !39 68 %3 = alloca i8, i32 %2, !dbg !40 69 store ptr %3, ptr %w, align 4, !dbg !38 70 call void @foo(ptr %c), !dbg !41 71 %4 = load ptr, ptr %w, align 4, !dbg !42 72 ret ptr %4, !dbg !43 73} 74 75!llvm.dbg.cu = !{!0} 76!llvm.module.flags = !{!12, !13} 77!llvm.ident = !{!14} 78 79!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251783) (llvm/trunk 251781)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 80!1 = !DIFile(filename: "test.c", directory: "/home/vk/repos/tmp/dwarf") 81!2 = !{} 82!4 = distinct !DISubprogram(name: "f2", scope: !1, file: !1, line: 20, type: !5, isLocal: false, isDefinition: true, scopeLine: 20, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 83!5 = !DISubroutineType(types: !6) 84!6 = !{!7, !7, !7} 85!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 86!8 = distinct !DISubprogram(name: "f3", scope: !1, file: !1, line: 27, type: !9, isLocal: false, isDefinition: true, scopeLine: 27, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 87!9 = !DISubroutineType(types: !10) 88!10 = !{!11, !7, !7} 89!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32, align: 32) 90!12 = !{i32 2, !"Dwarf Version", i32 4} 91!13 = !{i32 2, !"Debug Info Version", i32 3} 92!14 = !{!"clang version 3.8.0 (trunk 251783) (llvm/trunk 251781)"} 93!15 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 20, type: !7) 94!16 = !DIExpression() 95!17 = !DILocation(line: 20, column: 12, scope: !4) 96!18 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 20, type: !7) 97!19 = !DILocation(line: 20, column: 19, scope: !4) 98!20 = !DILocalVariable(name: "c", scope: !4, file: !1, line: 21, type: !7) 99!21 = !DILocation(line: 21, column: 7, scope: !4) 100!22 = !DILocation(line: 21, column: 40, scope: !4) 101!23 = !DILocation(line: 21, column: 44, scope: !4) 102!24 = !DILocation(line: 21, column: 42, scope: !4) 103!25 = !DILocation(line: 22, column: 3, scope: !4) 104!26 = !DILocation(line: 23, column: 10, scope: !4) 105!27 = !DILocation(line: 23, column: 3, scope: !4) 106!28 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 27, type: !7) 107!29 = !DILocation(line: 27, column: 13, scope: !8) 108!30 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 27, type: !7) 109!31 = !DILocation(line: 27, column: 20, scope: !8) 110!32 = !DILocalVariable(name: "c", scope: !8, file: !1, line: 28, type: !7) 111!33 = !DILocation(line: 28, column: 7, scope: !8) 112!34 = !DILocation(line: 28, column: 40, scope: !8) 113!35 = !DILocation(line: 28, column: 44, scope: !8) 114!36 = !DILocation(line: 28, column: 42, scope: !8) 115!37 = !DILocalVariable(name: "w", scope: !8, file: !1, line: 29, type: !11) 116!38 = !DILocation(line: 29, column: 8, scope: !8) 117!39 = !DILocation(line: 29, column: 19, scope: !8) 118!40 = !DILocation(line: 29, column: 12, scope: !8) 119!41 = !DILocation(line: 30, column: 3, scope: !8) 120!42 = !DILocation(line: 31, column: 10, scope: !8) 121!43 = !DILocation(line: 31, column: 3, scope: !8) 122