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