1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -enable-misched \ 2 ; RUN: -verify-machineinstrs | FileCheck %s 3 ; 4 ; Test MachineScheduler handling of DBG_VALUE. 5 ; rdar://12776937. 6 ; 7 ; CHECK: %if.else581 8 ; CHECK: DEBUG_VALUE: num1 9 ; CHECK: call 10 11 %union.rec = type {} 12 13 @.str15 = external hidden unnamed_addr constant [6 x i8], align 1 14 15 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone 16 17 define i32 @AttachGalley(%union.rec** nocapture %suspend_pt) nounwind uwtable ssp { 18 entry: 19 %num14075 = alloca [20 x i8], align 16 20 br label %if.end33 21 22 if.end33: ; preds = %entry 23 %cmp1733 = icmp eq i32 undef, 0 24 br label %if.else581 25 26 if.else581: ; preds = %if.end33 27 %cmp586 = icmp eq i8 undef, -123 28 br i1 %cmp586, label %if.then588, label %if.else594 29 30 if.then588: ; preds = %if.else581 31 br label %for.cond1710.preheader 32 33 if.else594: ; preds = %if.else581 34 unreachable 35 36 for.cond1710.preheader: ; preds = %if.then588 37 br label %for.cond1710 38 39 for.cond1710: ; preds = %for.cond1710, %for.cond1710.preheader 40 br i1 undef, label %for.cond1710, label %if.then3344 41 42 if.then3344: 43 br label %if.then4073 44 45 if.then4073: ; preds = %if.then3344 46 call void @llvm.dbg.declare(metadata [20 x i8]* %num14075, metadata !4, metadata !MDExpression()), !dbg !MDLocation(scope: !5) 47 %arraydecay4078 = getelementptr inbounds [20 x i8], [20 x i8]* %num14075, i64 0, i64 0 48 %0 = load i32, i32* undef, align 4 49 %add4093 = add nsw i32 %0, 0 50 %conv4094 = sitofp i32 %add4093 to float 51 %div4095 = fdiv float %conv4094, 5.670000e+02 52 %conv4096 = fpext float %div4095 to double 53 %call4097 = call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* %arraydecay4078, i32 0, i64 20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str15, i64 0, i64 0), double %conv4096) nounwind 54 br i1 %cmp1733, label %if.then4107, label %if.else4114 55 56 if.then4107: ; preds = %if.then4073 57 unreachable 58 59 if.else4114: ; preds = %if.then4073 60 unreachable 61 } 62 63 declare i32 @__sprintf_chk(i8*, i32, i64, i8*, ...) 64 65 !llvm.dbg.cu = !{!0} 66 !llvm.module.flags = !{!35} 67 68 !0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.3 (trunk 168918) (llvm/trunk 168920)", isOptimized: true, emissionKind: 0, file: !19, enums: !2, retainedTypes: !2, subprograms: !20, globals: !2) 69 !1 = !{!2} 70 !2 = !{} 71 !4 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "num1", line: 815, scope: !5, file: !14, type: !15) 72 !5 = distinct !MDLexicalBlock(line: 815, column: 0, file: !14, scope: !6) 73 !6 = distinct !MDLexicalBlock(line: 812, column: 0, file: !14, scope: !7) 74 !7 = distinct !MDLexicalBlock(line: 807, column: 0, file: !14, scope: !8) 75 !8 = distinct !MDLexicalBlock(line: 440, column: 0, file: !14, scope: !9) 76 !9 = distinct !MDLexicalBlock(line: 435, column: 0, file: !14, scope: !10) 77 !10 = distinct !MDLexicalBlock(line: 434, column: 0, file: !14, scope: !11) 78 !11 = distinct !MDLexicalBlock(line: 250, column: 0, file: !14, scope: !12) 79 !12 = distinct !MDLexicalBlock(line: 249, column: 0, file: !14, scope: !13) 80 !13 = distinct !MDLexicalBlock(line: 221, column: 0, file: !14, scope: !21) 81 !14 = !MDFile(filename: "MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c", directory: "MultiSource/Benchmarks/MiBench/consumer-typeset") 82 !15 = !MDCompositeType(tag: DW_TAG_array_type, size: 160, align: 8, baseType: !16, elements: !17) 83 !16 = !MDBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) 84 !17 = !{!18} 85 !18 = !MDSubrange(count: 20) 86 !19 = !MDFile(filename: "MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c", directory: "MultiSource/Benchmarks/MiBench/consumer-typeset") 87 88 !20 = !{!21} 89 !21 = !MDSubprogram(name: "AttachGalley", isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 1, file: !19, scope: !14, type: !22, function: i32 (%union.rec**)* @AttachGalley) 90 !22 = !MDSubroutineType(types: !23) 91 !23 = !{null} 92 93 ; Test DebugValue uses visited by RegisterPressureTracker findUseBetween(). 94 ; 95 ; CHECK: @main 96 ; CHECK: DEBUG_VALUE: main:X 97 ; CHECK: call 98 99 %"class.__gnu_cxx::hash_map" = type { %"class.__gnu_cxx::hashtable" } 100 %"class.__gnu_cxx::hashtable" = type { i64, i64, i64, i64, i64, i64 } 101 102 define void @main() uwtable ssp { 103 entry: 104 %X = alloca %"class.__gnu_cxx::hash_map", align 8 105 br i1 undef, label %cond.true, label %cond.end 106 107 cond.true: ; preds = %entry 108 unreachable 109 110 cond.end: ; preds = %entry 111 call void @llvm.dbg.declare(metadata %"class.__gnu_cxx::hash_map"* %X, metadata !31, metadata !MDExpression()), !dbg !MDLocation(scope: !37) 112 %_M_num_elements.i.i.i.i = getelementptr inbounds %"class.__gnu_cxx::hash_map", %"class.__gnu_cxx::hash_map"* %X, i64 0, i32 0, i32 5 113 invoke void @_Znwm() 114 to label %exit.i unwind label %lpad2.i.i.i.i 115 116 exit.i: ; preds = %cond.end 117 unreachable 118 119 lpad2.i.i.i.i: ; preds = %cond.end 120 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 121 cleanup 122 br i1 undef, label %lpad.body.i.i, label %if.then.i.i.i.i.i.i.i.i 123 124 if.then.i.i.i.i.i.i.i.i: ; preds = %lpad2.i.i.i.i 125 unreachable 126 127 lpad.body.i.i: ; preds = %lpad2.i.i.i.i 128 resume { i8*, i32 } %0 129 } 130 131 declare i32 @__gxx_personality_v0(...) 132 133 declare void @_Znwm() 134 135 !llvm.dbg.cu = !{!30} 136 137 !30 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 169129) (llvm/trunk 169135)", isOptimized: true, emissionKind: 0, file: !34, enums: !2, retainedTypes: !2, subprograms: !36) 138 !31 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "X", line: 29, scope: !37, type: !32) 139 !32 = !MDDerivedType(tag: DW_TAG_typedef, name: "HM", line: 28, file: !34, baseType: null) 140 !33 = !MDFile(filename: "SingleSource/Benchmarks/Shootout-C++/hash.cpp", directory: "SingleSource/Benchmarks/Shootout-C++") 141 !34 = !MDFile(filename: "SingleSource/Benchmarks/Shootout-C++/hash.cpp", directory: "SingleSource/Benchmarks/Shootout-C++") 142 !35 = !{i32 1, !"Debug Info Version", i32 3} 143 !36 = !{!37} 144 !37 = !MDSubprogram(name: "main", isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 1, file: !19, scope: !14, type: !22, function: void ()* @main) 145