1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \ 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F0 3*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \ 4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F1 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; void foo(int *); 7*9880d681SAndroid Build Coastguard Worker; 8*9880d681SAndroid Build Coastguard Worker; int f0(int a, int b, int c, int d, int e) { 9*9880d681SAndroid Build Coastguard Worker; int x = a + b + c + d + e; 10*9880d681SAndroid Build Coastguard Worker; foo(&x); 11*9880d681SAndroid Build Coastguard Worker; return x; 12*9880d681SAndroid Build Coastguard Worker; } 13*9880d681SAndroid Build Coastguard Worker; 14*9880d681SAndroid Build Coastguard Worker; int f1(int a, int b, int c, int d, int e) { 15*9880d681SAndroid Build Coastguard Worker; int x __attribute__((aligned(16))) = a + b + c + d + e; 16*9880d681SAndroid Build Coastguard Worker; foo(&x); 17*9880d681SAndroid Build Coastguard Worker; return x; 18*9880d681SAndroid Build Coastguard Worker; } 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.start(i64, i8* nocapture) 21*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.end(i64, i8* nocapture) 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Workerdeclare void @foo(i32*) 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; F0: DW_AT_name {{.*}}"e" 26*9880d681SAndroid Build Coastguard Worker; F0: DW_TAG_variable 27*9880d681SAndroid Build Coastguard Worker; F0-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[LOC:.*]]) 28*9880d681SAndroid Build Coastguard Worker; F0-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x") 29*9880d681SAndroid Build Coastguard Worker; 30*9880d681SAndroid Build Coastguard Worker; x -> DW_OP_reg1(51) 31*9880d681SAndroid Build Coastguard Worker; F0: [[LOC]]: Beginning address offset: 0x0000000000000028 32*9880d681SAndroid Build Coastguard Worker; F0: Ending address offset: 0x0000000000000030 33*9880d681SAndroid Build Coastguard Worker; F0: Location description: 51 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Workerdefine i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 { 36*9880d681SAndroid Build Coastguard Workerentry: 37*9880d681SAndroid Build Coastguard Worker %x = alloca i32, align 4 38*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !9, metadata !DIExpression()), !dbg !27 39*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !10, metadata !DIExpression()), !dbg !28 40*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !11, metadata !DIExpression()), !dbg !29 41*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !12, metadata !DIExpression()), !dbg !30 42*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !13, metadata !DIExpression()), !dbg !31 43*9880d681SAndroid Build Coastguard Worker %0 = bitcast i32* %x to i8*, !dbg !32 44*9880d681SAndroid Build Coastguard Worker call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !32 45*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %b, %a, !dbg !33 46*9880d681SAndroid Build Coastguard Worker %add1 = add nsw i32 %add, %c, !dbg !34 47*9880d681SAndroid Build Coastguard Worker %add2 = add nsw i32 %add1, %d, !dbg !35 48*9880d681SAndroid Build Coastguard Worker %add3 = add nsw i32 %add2, %e, !dbg !36 49*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !14, metadata !DIExpression()), !dbg !37 50*9880d681SAndroid Build Coastguard Worker store i32 %add3, i32* %x, align 4, !dbg !37, !tbaa !38 51*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !14, metadata !26), !dbg !37 52*9880d681SAndroid Build Coastguard Worker call void @foo(i32* nonnull %x) #4, !dbg !42 53*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !14, metadata !26), !dbg !37 54*9880d681SAndroid Build Coastguard Worker %1 = load i32, i32* %x, align 4, !dbg !43, !tbaa !38 55*9880d681SAndroid Build Coastguard Worker call void @llvm.lifetime.end(i64 4, i8* %0) #4, !dbg !44 56*9880d681SAndroid Build Coastguard Worker ret i32 %1, !dbg !45 57*9880d681SAndroid Build Coastguard Worker} 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker; F1: DW_AT_name {{.*}}"x" 61*9880d681SAndroid Build Coastguard Worker; F1: DW_AT_name {{.*}}"e" 62*9880d681SAndroid Build Coastguard Worker; F1: DW_TAG_variable 63*9880d681SAndroid Build Coastguard Worker; F1-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[LOC:.*]]) 64*9880d681SAndroid Build Coastguard Worker; F1-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x") 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Worker; x -> DW_OP_reg1(51) 67*9880d681SAndroid Build Coastguard Worker; F1: [[LOC]]: Beginning address offset: 0x0000000000000080 68*9880d681SAndroid Build Coastguard Worker; F1: Ending address offset: 0x0000000000000088 69*9880d681SAndroid Build Coastguard Worker; F1: Location description: 51 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Workerdefine i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 { 72*9880d681SAndroid Build Coastguard Workerentry: 73*9880d681SAndroid Build Coastguard Worker %x = alloca i32, align 16 74*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !17, metadata !DIExpression()), !dbg !46 75*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %b, i64 0, metadata !18, metadata !DIExpression()), !dbg !47 76*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %c, i64 0, metadata !19, metadata !DIExpression()), !dbg !48 77*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !20, metadata !DIExpression()), !dbg !49 78*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %e, i64 0, metadata !21, metadata !DIExpression()), !dbg !50 79*9880d681SAndroid Build Coastguard Worker %0 = bitcast i32* %x to i8*, !dbg !51 80*9880d681SAndroid Build Coastguard Worker call void @llvm.lifetime.start(i64 4, i8* %0) #4, !dbg !51 81*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %b, %a, !dbg !52 82*9880d681SAndroid Build Coastguard Worker %add1 = add nsw i32 %add, %c, !dbg !53 83*9880d681SAndroid Build Coastguard Worker %add2 = add nsw i32 %add1, %d, !dbg !54 84*9880d681SAndroid Build Coastguard Worker %add3 = add nsw i32 %add2, %e, !dbg !55 85*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %add3, i64 0, metadata !22, metadata !DIExpression()), !dbg !56 86*9880d681SAndroid Build Coastguard Worker store i32 %add3, i32* %x, align 16, !dbg !56, !tbaa !38 87*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !22, metadata !26), !dbg !56 88*9880d681SAndroid Build Coastguard Worker call void @foo(i32* nonnull %x) #4, !dbg !57 89*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.value(metadata i32* %x, i64 0, metadata !22, metadata !26), !dbg !56 90*9880d681SAndroid Build Coastguard Worker %1 = load i32, i32* %x, align 16, !dbg !58, !tbaa !38 91*9880d681SAndroid Build Coastguard Worker call void @llvm.lifetime.end(i64 4, i8* %0) #4, !dbg !59 92*9880d681SAndroid Build Coastguard Worker ret i32 %1, !dbg !60 93*9880d681SAndroid Build Coastguard Worker} 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) 96*9880d681SAndroid Build Coastguard Worker 97*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 98*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!23, !24} 99*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!25} 100*9880d681SAndroid Build Coastguard Worker 101*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: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 102*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "test.c", directory: "/home/vk/repos/tmp/dwarf") 103*9880d681SAndroid Build Coastguard Worker!2 = !{} 104*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "f0", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !8) 105*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6) 106*9880d681SAndroid Build Coastguard Worker!6 = !{!7, !7, !7, !7, !7, !7} 107*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 108*9880d681SAndroid Build Coastguard Worker!8 = !{!9, !10, !11, !12, !13, !14} 109*9880d681SAndroid Build Coastguard Worker!9 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 4, type: !7) 110*9880d681SAndroid Build Coastguard Worker!10 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 4, type: !7) 111*9880d681SAndroid Build Coastguard Worker!11 = !DILocalVariable(name: "c", arg: 3, scope: !4, file: !1, line: 4, type: !7) 112*9880d681SAndroid Build Coastguard Worker!12 = !DILocalVariable(name: "d", arg: 4, scope: !4, file: !1, line: 4, type: !7) 113*9880d681SAndroid Build Coastguard Worker!13 = !DILocalVariable(name: "e", arg: 5, scope: !4, file: !1, line: 4, type: !7) 114*9880d681SAndroid Build Coastguard Worker!14 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 5, type: !7) 115*9880d681SAndroid Build Coastguard Worker!15 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 11, type: !5, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !16) 116*9880d681SAndroid Build Coastguard Worker!16 = !{!17, !18, !19, !20, !21, !22} 117*9880d681SAndroid Build Coastguard Worker!17 = !DILocalVariable(name: "a", arg: 1, scope: !15, file: !1, line: 11, type: !7) 118*9880d681SAndroid Build Coastguard Worker!18 = !DILocalVariable(name: "b", arg: 2, scope: !15, file: !1, line: 11, type: !7) 119*9880d681SAndroid Build Coastguard Worker!19 = !DILocalVariable(name: "c", arg: 3, scope: !15, file: !1, line: 11, type: !7) 120*9880d681SAndroid Build Coastguard Worker!20 = !DILocalVariable(name: "d", arg: 4, scope: !15, file: !1, line: 11, type: !7) 121*9880d681SAndroid Build Coastguard Worker!21 = !DILocalVariable(name: "e", arg: 5, scope: !15, file: !1, line: 11, type: !7) 122*9880d681SAndroid Build Coastguard Worker!22 = !DILocalVariable(name: "x", scope: !15, file: !1, line: 12, type: !7) 123*9880d681SAndroid Build Coastguard Worker!23 = !{i32 2, !"Dwarf Version", i32 4} 124*9880d681SAndroid Build Coastguard Worker!24 = !{i32 2, !"Debug Info Version", i32 3} 125*9880d681SAndroid Build Coastguard Worker!25 = !{!"clang version 3.8.0 (trunk 251783) (llvm/trunk 251781)"} 126*9880d681SAndroid Build Coastguard Worker!26 = !DIExpression(DW_OP_deref) 127*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 4, column: 12, scope: !4) 128*9880d681SAndroid Build Coastguard Worker!28 = !DILocation(line: 4, column: 19, scope: !4) 129*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 4, column: 26, scope: !4) 130*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 4, column: 33, scope: !4) 131*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 4, column: 40, scope: !4) 132*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 5, column: 3, scope: !4) 133*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 5, column: 13, scope: !4) 134*9880d681SAndroid Build Coastguard Worker!34 = !DILocation(line: 5, column: 17, scope: !4) 135*9880d681SAndroid Build Coastguard Worker!35 = !DILocation(line: 5, column: 21, scope: !4) 136*9880d681SAndroid Build Coastguard Worker!36 = !DILocation(line: 5, column: 25, scope: !4) 137*9880d681SAndroid Build Coastguard Worker!37 = !DILocation(line: 5, column: 7, scope: !4) 138*9880d681SAndroid Build Coastguard Worker!38 = !{!39, !39, i64 0} 139*9880d681SAndroid Build Coastguard Worker!39 = !{!"int", !40, i64 0} 140*9880d681SAndroid Build Coastguard Worker!40 = !{!"omnipotent char", !41, i64 0} 141*9880d681SAndroid Build Coastguard Worker!41 = !{!"Simple C/C++ TBAA"} 142*9880d681SAndroid Build Coastguard Worker!42 = !DILocation(line: 6, column: 3, scope: !4) 143*9880d681SAndroid Build Coastguard Worker!43 = !DILocation(line: 7, column: 10, scope: !4) 144*9880d681SAndroid Build Coastguard Worker!44 = !DILocation(line: 8, column: 1, scope: !4) 145*9880d681SAndroid Build Coastguard Worker!45 = !DILocation(line: 7, column: 3, scope: !4) 146*9880d681SAndroid Build Coastguard Worker!46 = !DILocation(line: 11, column: 12, scope: !15) 147*9880d681SAndroid Build Coastguard Worker!47 = !DILocation(line: 11, column: 19, scope: !15) 148*9880d681SAndroid Build Coastguard Worker!48 = !DILocation(line: 11, column: 26, scope: !15) 149*9880d681SAndroid Build Coastguard Worker!49 = !DILocation(line: 11, column: 33, scope: !15) 150*9880d681SAndroid Build Coastguard Worker!50 = !DILocation(line: 11, column: 40, scope: !15) 151*9880d681SAndroid Build Coastguard Worker!51 = !DILocation(line: 12, column: 3, scope: !15) 152*9880d681SAndroid Build Coastguard Worker!52 = !DILocation(line: 12, column: 42, scope: !15) 153*9880d681SAndroid Build Coastguard Worker!53 = !DILocation(line: 12, column: 46, scope: !15) 154*9880d681SAndroid Build Coastguard Worker!54 = !DILocation(line: 12, column: 50, scope: !15) 155*9880d681SAndroid Build Coastguard Worker!55 = !DILocation(line: 12, column: 54, scope: !15) 156*9880d681SAndroid Build Coastguard Worker!56 = !DILocation(line: 12, column: 7, scope: !15) 157*9880d681SAndroid Build Coastguard Worker!57 = !DILocation(line: 13, column: 3, scope: !15) 158*9880d681SAndroid Build Coastguard Worker!58 = !DILocation(line: 14, column: 10, scope: !15) 159*9880d681SAndroid Build Coastguard Worker!59 = !DILocation(line: 15, column: 1, scope: !15) 160*9880d681SAndroid Build Coastguard Worker!60 = !DILocation(line: 14, column: 3, scope: !15) 161