1; RUN: llc %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -enable-misched 2; RUN: llvm-dwarfdump -v %t | FileCheck %s 3 4; rdar://13183203 5; Make sure when misched is enabled, we still have location information for 6; function parameters. 7; CHECK: .debug_info contents: 8; CHECK: DW_TAG_compile_unit 9; CHECK: DW_TAG_subprogram 10; CHECK-NOT: DW_TAG 11; CHECK: DW_AT_name {{.*}} "Proc8" 12; CHECK-NOT: {{DW_TAG|NULL}} 13; CHECK: DW_TAG_formal_parameter 14; CHECK-NOT: DW_TAG 15; CHECK: DW_AT_location 16; CHECK-NOT: DW_TAG 17; CHECK: DW_AT_name {{.*}} "Array1Par" 18; CHECK-NOT: {{DW_TAG|NULL}} 19; CHECK: DW_TAG_formal_parameter 20; CHECK-NOT: DW_TAG 21; CHECK: DW_AT_location 22; CHECK-NOT: DW_TAG 23; CHECK: DW_AT_name {{.*}} "Array2Par" 24; CHECK-NOT: {{DW_TAG|NULL}} 25; CHECK: DW_TAG_formal_parameter 26; CHECK-NOT: DW_TAG 27; CHECK: DW_AT_location 28; CHECK-NOT: DW_TAG 29; CHECK: DW_AT_name {{.*}} "IntParI1" 30; CHECK-NOT: {{DW_TAG|NULL}} 31; CHECK: DW_TAG_formal_parameter 32; CHECK-NOT: DW_TAG 33; CHECK: DW_AT_location 34; CHECK-NOT: DW_TAG 35; CHECK: DW_AT_name {{.*}} "IntParI2" 36 37source_filename = "test/DebugInfo/X86/misched-dbg-value.ll" 38 39%struct.Record = type { %struct.Record*, i32, i32, i32, [31 x i8] } 40 41@Version = global [4 x i8] c"1.1\00", align 1, !dbg !0 42@IntGlob = common global i32 0, align 4, !dbg !7 43@BoolGlob = common global i32 0, align 4, !dbg !10 44@Char1Glob = common global i8 0, align 1, !dbg !13 45@Char2Glob = common global i8 0, align 1, !dbg !15 46@Array1Glob = common global [51 x i32] zeroinitializer, align 16, !dbg !17 47@Array2Glob = common global [51 x [51 x i32]] zeroinitializer, align 16, !dbg !23 48@PtrGlb = common global %struct.Record* null, align 8, !dbg !28 49@PtrGlbNext = common global %struct.Record* null, align 8, !dbg !54 50 51; Function Attrs: nounwind optsize 52define void @Proc8(i32* nocapture %Array1Par, [51 x i32]* nocapture %Array2Par, i32 %IntParI1, i32 %IntParI2) #0 !dbg !61 { 53entry: 54 tail call void @llvm.dbg.value(metadata i32* %Array1Par, metadata !67, metadata !73), !dbg !74 55 tail call void @llvm.dbg.value(metadata [51 x i32]* %Array2Par, metadata !68, metadata !73), !dbg !75 56 tail call void @llvm.dbg.value(metadata i32 %IntParI1, metadata !69, metadata !73), !dbg !76 57 tail call void @llvm.dbg.value(metadata i32 %IntParI2, metadata !70, metadata !73), !dbg !77 58 %add = add i32 %IntParI1, 5, !dbg !78 59 tail call void @llvm.dbg.value(metadata i32 %add, metadata !71, metadata !73), !dbg !78 60 %idxprom = sext i32 %add to i64, !dbg !79 61 %arrayidx = getelementptr inbounds i32, i32* %Array1Par, i64 %idxprom, !dbg !79 62 store i32 %IntParI2, i32* %arrayidx, align 4, !dbg !79 63 %add3 = add nsw i32 %IntParI1, 6, !dbg !80 64 %idxprom4 = sext i32 %add3 to i64, !dbg !80 65 %arrayidx5 = getelementptr inbounds i32, i32* %Array1Par, i64 %idxprom4, !dbg !80 66 store i32 %IntParI2, i32* %arrayidx5, align 4, !dbg !80 67 %add6 = add nsw i32 %IntParI1, 35, !dbg !81 68 %idxprom7 = sext i32 %add6 to i64, !dbg !81 69 %arrayidx8 = getelementptr inbounds i32, i32* %Array1Par, i64 %idxprom7, !dbg !81 70 store i32 %add, i32* %arrayidx8, align 4, !dbg !81 71 tail call void @llvm.dbg.value(metadata i32 %add, metadata !72, metadata !73), !dbg !82 72 br label %for.body, !dbg !82 73 74for.body: ; preds = %for.body, %entry 75 %indvars.iv = phi i64 [ %idxprom, %entry ], [ %indvars.iv.next, %for.body ] 76 %IntIndex.046 = phi i32 [ %add, %entry ], [ %inc, %for.body ] 77 %arrayidx13 = getelementptr inbounds [51 x i32], [51 x i32]* %Array2Par, i64 %idxprom, i64 %indvars.iv, !dbg !84 78 store i32 %add, i32* %arrayidx13, align 4, !dbg !84 79 %inc = add nsw i32 %IntIndex.046, 1, !dbg !82 80 tail call void @llvm.dbg.value(metadata i32 %inc, metadata !72, metadata !73), !dbg !82 81 %cmp = icmp sgt i32 %inc, %add3, !dbg !82 82 %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !82 83 br i1 %cmp, label %for.end, label %for.body, !dbg !82 84 85for.end: ; preds = %for.body 86 %sub = add nsw i32 %IntParI1, 4, !dbg !85 87 %idxprom14 = sext i32 %sub to i64, !dbg !85 88 %arrayidx17 = getelementptr inbounds [51 x i32], [51 x i32]* %Array2Par, i64 %idxprom, i64 %idxprom14, !dbg !85 89 %0 = load i32, i32* %arrayidx17, align 4, !dbg !85 90 %inc18 = add nsw i32 %0, 1, !dbg !85 91 store i32 %inc18, i32* %arrayidx17, align 4, !dbg !85 92 %1 = load i32, i32* %arrayidx, align 4, !dbg !86 93 %add22 = add nsw i32 %IntParI1, 25, !dbg !86 94 %idxprom23 = sext i32 %add22 to i64, !dbg !86 95 %arrayidx25 = getelementptr inbounds [51 x i32], [51 x i32]* %Array2Par, i64 %idxprom23, i64 %idxprom, !dbg !86 96 store i32 %1, i32* %arrayidx25, align 4, !dbg !86 97 store i32 5, i32* @IntGlob, align 4, !dbg !87 98 ret void, !dbg !88 99} 100 101; Function Attrs: nounwind readnone 102declare void @llvm.dbg.value(metadata, metadata, metadata) #1 103 104attributes #0 = { nounwind optsize } 105attributes #1 = { nounwind readnone } 106 107!llvm.dbg.cu = !{!56} 108!llvm.module.flags = !{!60} 109 110!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 111!1 = !DIGlobalVariable(name: "Version", scope: null, file: !2, line: 111, type: !3, isLocal: false, isDefinition: true) 112!2 = !DIFile(filename: "dry.c", directory: "/Users/manmanren/test-Nov/rdar_13183203/test2") 113!3 = !DICompositeType(tag: DW_TAG_array_type, baseType: !4, size: 32, align: 8, elements: !5) 114!4 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) 115!5 = !{!6} 116!6 = !DISubrange(count: 4) ; [ DW_TAG_enumerator ] [Ident1 :: 0] 117!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression()) ; [ DW_TAG_enumerator ] [Ident2 :: 10000] 118!8 = !DIGlobalVariable(name: "IntGlob", scope: null, file: !2, line: 171, type: !9, isLocal: false, isDefinition: true) ; [ DW_TAG_enumerator ] [Ident3 :: 10001] 119!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) ; [ DW_TAG_enumerator ] [Ident4 :: 10002] 120!10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression()) ; [ DW_TAG_enumerator ] [Ident5 :: 10003] 121!11 = !DIGlobalVariable(name: "BoolGlob", scope: null, file: !2, line: 172, type: !12, isLocal: false, isDefinition: true) 122!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "boolean", file: !2, line: 149, baseType: !9) 123!13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression()) 124!14 = !DIGlobalVariable(name: "Char1Glob", scope: null, file: !2, line: 173, type: !4, isLocal: false, isDefinition: true) 125!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) 126!16 = !DIGlobalVariable(name: "Char2Glob", scope: null, file: !2, line: 174, type: !4, isLocal: false, isDefinition: true) 127!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) 128!18 = !DIGlobalVariable(name: "Array1Glob", scope: null, file: !2, line: 175, type: !19, isLocal: false, isDefinition: true) 129!19 = !DIDerivedType(tag: DW_TAG_typedef, name: "Array1Dim", file: !2, line: 135, baseType: !20) 130!20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 1632, align: 32, elements: !21) 131!21 = !{!22} 132!22 = !DISubrange(count: 51) 133!23 = !DIGlobalVariableExpression(var: !24, expr: !DIExpression()) 134!24 = !DIGlobalVariable(name: "Array2Glob", scope: null, file: !2, line: 176, type: !25, isLocal: false, isDefinition: true) 135!25 = !DIDerivedType(tag: DW_TAG_typedef, name: "Array2Dim", file: !2, line: 136, baseType: !26) 136!26 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 83232, align: 32, elements: !27) 137!27 = !{!22, !22} 138!28 = !DIGlobalVariableExpression(var: !29, expr: !DIExpression()) 139!29 = !DIGlobalVariable(name: "PtrGlb", scope: null, file: !2, line: 177, type: !30, isLocal: false, isDefinition: true) 140!30 = !DIDerivedType(tag: DW_TAG_typedef, name: "RecordPtr", file: !2, line: 148, baseType: !31) 141!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !32, size: 64, align: 64) 142!32 = !DIDerivedType(tag: DW_TAG_typedef, name: "RecordType", file: !2, line: 147, baseType: !33) 143!33 = !DICompositeType(tag: DW_TAG_structure_type, name: "Record", file: !2, line: 138, size: 448, align: 64, elements: !34) 144!34 = !{!35, !37, !46, !47, !49} 145!35 = !DIDerivedType(tag: DW_TAG_member, name: "PtrComp", scope: !33, file: !2, line: 140, baseType: !36, size: 64, align: 64) 146!36 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !33, size: 64, align: 64) 147!37 = !DIDerivedType(tag: DW_TAG_member, name: "Discr", scope: !33, file: !2, line: 141, baseType: !38, size: 32, align: 32, offset: 64) 148!38 = !DIDerivedType(tag: DW_TAG_typedef, name: "Enumeration", file: !2, line: 128, baseType: !39) 149!39 = !DICompositeType(tag: DW_TAG_enumeration_type, file: !2, line: 128, size: 32, align: 32, elements: !40) 150!40 = !{!41, !42, !43, !44, !45} 151!41 = !DIEnumerator(name: "Ident1", value: 0) 152!42 = !DIEnumerator(name: "Ident2", value: 10000) 153!43 = !DIEnumerator(name: "Ident3", value: 10001) 154!44 = !DIEnumerator(name: "Ident4", value: 10002) 155!45 = !DIEnumerator(name: "Ident5", value: 10003) 156!46 = !DIDerivedType(tag: DW_TAG_member, name: "EnumComp", scope: !33, file: !2, line: 142, baseType: !38, size: 32, align: 32, offset: 96) 157!47 = !DIDerivedType(tag: DW_TAG_member, name: "IntComp", scope: !33, file: !2, line: 143, baseType: !48, size: 32, align: 32, offset: 128) 158!48 = !DIDerivedType(tag: DW_TAG_typedef, name: "OneToFifty", file: !2, line: 132, baseType: !9) 159!49 = !DIDerivedType(tag: DW_TAG_member, name: "StringComp", scope: !33, file: !2, line: 144, baseType: !50, size: 248, align: 8, offset: 160) 160!50 = !DIDerivedType(tag: DW_TAG_typedef, name: "String30", file: !2, line: 134, baseType: !51) 161!51 = !DICompositeType(tag: DW_TAG_array_type, baseType: !4, size: 248, align: 8, elements: !52) 162!52 = !{!53} 163!53 = !DISubrange(count: 31) 164!54 = !DIGlobalVariableExpression(var: !55, expr: !DIExpression()) 165!55 = !DIGlobalVariable(name: "PtrGlbNext", scope: null, file: !2, line: 178, type: !30, isLocal: false, isDefinition: true) 166!56 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.3 (trunk 175015)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !57, retainedTypes: !58, globals: !59, imports: !58) 167!57 = !{!39} 168!58 = !{} 169!59 = !{!0, !7, !10, !13, !15, !17, !23, !28, !54} 170!60 = !{i32 1, !"Debug Info Version", i32 3} 171!61 = distinct !DISubprogram(name: "Proc8", scope: !2, file: !2, line: 180, type: !62, isLocal: false, isDefinition: true, scopeLine: 185, virtualIndex: 6, isOptimized: true, unit: !56, retainedNodes: !66) 172!62 = !DISubroutineType(types: !63) 173!63 = !{null, !64, !65, !48, !48} 174!64 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64) 175!65 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64, align: 64) 176!66 = !{!67, !68, !69, !70, !71, !72} 177!67 = !DILocalVariable(name: "Array1Par", arg: 1, scope: !61, file: !2, line: 181, type: !64) 178!68 = !DILocalVariable(name: "Array2Par", arg: 2, scope: !61, file: !2, line: 182, type: !65) 179!69 = !DILocalVariable(name: "IntParI1", arg: 3, scope: !61, file: !2, line: 183, type: !48) 180!70 = !DILocalVariable(name: "IntParI2", arg: 4, scope: !61, file: !2, line: 184, type: !48) 181!71 = !DILocalVariable(name: "IntLoc", scope: !61, file: !2, line: 186, type: !48) 182!72 = !DILocalVariable(name: "IntIndex", scope: !61, file: !2, line: 187, type: !48) 183!73 = !DIExpression() 184!74 = !DILocation(line: 181, scope: !61) 185!75 = !DILocation(line: 182, scope: !61) 186!76 = !DILocation(line: 183, scope: !61) 187!77 = !DILocation(line: 184, scope: !61) 188!78 = !DILocation(line: 189, scope: !61) 189!79 = !DILocation(line: 190, scope: !61) 190!80 = !DILocation(line: 191, scope: !61) 191!81 = !DILocation(line: 192, scope: !61) 192!82 = !DILocation(line: 193, scope: !83) 193!83 = distinct !DILexicalBlock(scope: !61, file: !2, line: 193) 194!84 = !DILocation(line: 194, scope: !83) 195!85 = !DILocation(line: 195, scope: !61) 196!86 = !DILocation(line: 196, scope: !61) 197!87 = !DILocation(line: 197, scope: !61) 198!88 = !DILocation(line: 198, scope: !61) 199 200