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 15declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone 16 17define i32 @AttachGalley(%union.rec** nocapture %suspend_pt) nounwind uwtable ssp { 18entry: 19 %num14075 = alloca [20 x i8], align 16 20 br label %if.end33 21 22if.end33: ; preds = %entry 23 %cmp1733 = icmp eq i32 undef, 0 24 br label %if.else581 25 26if.else581: ; preds = %if.end33 27 %cmp586 = icmp eq i8 undef, -123 28 br i1 %cmp586, label %if.then588, label %if.else594 29 30if.then588: ; preds = %if.else581 31 br label %for.cond1710.preheader 32 33if.else594: ; preds = %if.else581 34 unreachable 35 36for.cond1710.preheader: ; preds = %if.then588 37 br label %for.cond1710 38 39for.cond1710: ; preds = %for.cond1710, %for.cond1710.preheader 40 br i1 undef, label %for.cond1710, label %if.then3344 41 42if.then3344: 43 br label %if.then4073 44 45if.then4073: ; preds = %if.then3344 46 call void @llvm.dbg.declare(metadata !{[20 x i8]* %num14075}, metadata !4) 47 %arraydecay4078 = getelementptr inbounds [20 x i8]* %num14075, i64 0, i64 0 48 %0 = load 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]* @.str15, i64 0, i64 0), double %conv4096) nounwind 54 br i1 %cmp1733, label %if.then4107, label %if.else4114 55 56if.then4107: ; preds = %if.then4073 57 unreachable 58 59if.else4114: ; preds = %if.then4073 60 unreachable 61} 62 63declare i32 @__sprintf_chk(i8*, i32, i64, i8*, ...) 64 65!llvm.dbg.cu = !{!0} 66 67!0 = metadata !{i32 786449, i32 0, i32 12, metadata !"MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c", metadata !"MultiSource/Benchmarks/MiBench/consumer-typeset", metadata !"clang version 3.3 (trunk 168918) (llvm/trunk 168920)", i1 true, i1 true, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1} ; [ DW_TAG_compile_unit ] [MultiSource/Benchmarks/MiBench/consumer-typeset/MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] [DW_LANG_C99] 68!1 = metadata !{metadata !2} 69!2 = metadata !{i32 0} 70!3 = metadata !{} 71!4 = metadata !{i32 786688, metadata !5, metadata !"num1", metadata !14, i32 815, metadata !15, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [num1] [line 815] 72!5 = metadata !{i32 786443, metadata !6, i32 815, i32 0, metadata !14, i32 177} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 73!6 = metadata !{i32 786443, metadata !7, i32 812, i32 0, metadata !14, i32 176} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 74!7 = metadata !{i32 786443, metadata !8, i32 807, i32 0, metadata !14, i32 175} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 75!8 = metadata !{i32 786443, metadata !9, i32 440, i32 0, metadata !14, i32 94} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 76!9 = metadata !{i32 786443, metadata !10, i32 435, i32 0, metadata !14, i32 91} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 77!10 = metadata !{i32 786443, metadata !11, i32 434, i32 0, metadata !14, i32 90} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 78!11 = metadata !{i32 786443, metadata !12, i32 250, i32 0, metadata !14, i32 24} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 79!12 = metadata !{i32 786443, metadata !13, i32 249, i32 0, metadata !14, i32 23} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 80!13 = metadata !{i32 786443, metadata !3, i32 221, i32 0, metadata !14, i32 19} ; [ DW_TAG_lexical_block ] [MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c] 81!14 = metadata !{i32 786473, metadata !19} ; [ DW_TAG_file_type ] 82!15 = metadata !{i32 786433, null, metadata !"", null, i32 0, i64 160, i64 8, i32 0, i32 0, metadata !16, metadata !17, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 160, align 8, offset 0] [from char] 83!16 = metadata !{i32 786468, null, metadata !"char", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char] 84!17 = metadata !{metadata !18} 85!18 = metadata !{i32 786465, i64 0, i64 20} ; [ DW_TAG_subrange_type ] [0, 19] 86!19 = metadata !{metadata !"MultiSource/Benchmarks/MiBench/consumer-typeset/z19.c", metadata !"MultiSource/Benchmarks/MiBench/consumer-typeset"} 87 88; Test DebugValue uses visited by RegisterPressureTracker findUseBetween(). 89; 90; CHECK: @main 91; CHECK: DEBUG_VALUE: X 92; CHECK: call 93 94%"class.__gnu_cxx::hash_map" = type { %"class.__gnu_cxx::hashtable" } 95%"class.__gnu_cxx::hashtable" = type { i64, i64, i64, i64, i64, i64 } 96 97define void @main() uwtable ssp { 98entry: 99 %X = alloca %"class.__gnu_cxx::hash_map", align 8 100 br i1 undef, label %cond.true, label %cond.end 101 102cond.true: ; preds = %entry 103 unreachable 104 105cond.end: ; preds = %entry 106 call void @llvm.dbg.declare(metadata !{%"class.__gnu_cxx::hash_map"* %X}, metadata !31) 107 %_M_num_elements.i.i.i.i = getelementptr inbounds %"class.__gnu_cxx::hash_map"* %X, i64 0, i32 0, i32 5 108 invoke void @_Znwm() 109 to label %exit.i unwind label %lpad2.i.i.i.i 110 111exit.i: ; preds = %cond.end 112 unreachable 113 114lpad2.i.i.i.i: ; preds = %cond.end 115 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 116 cleanup 117 br i1 undef, label %lpad.body.i.i, label %if.then.i.i.i.i.i.i.i.i 118 119if.then.i.i.i.i.i.i.i.i: ; preds = %lpad2.i.i.i.i 120 unreachable 121 122lpad.body.i.i: ; preds = %lpad2.i.i.i.i 123 resume { i8*, i32 } %0 124} 125 126declare i32 @__gxx_personality_v0(...) 127 128declare void @_Znwm() 129 130!llvm.dbg.cu = !{!30} 131 132!30 = metadata !{i32 786449, i32 0, i32 4, metadata !"SingleSource/Benchmarks/Shootout-C++/hash.cpp", metadata !"SingleSource/Benchmarks/Shootout-C++", metadata !"clang version 3.3 (trunk 169129) (llvm/trunk 169135)", i1 true, i1 true, metadata !"", i32 0, null, null, null, null} ; [ DW_TAG_compile_unit ] [SingleSource/Benchmarks/Shootout-C++/hash.cpp] [DW_LANG_C_plus_plus] 133!31 = metadata !{i32 786688, null, metadata !"X", null, i32 29, metadata !32, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [X] [line 29] 134!32 = metadata !{i32 786454, null, metadata !"HM", metadata !33, i32 28, i64 0, i64 0, i64 0, i32 0, null} ; [ DW_TAG_typedef ] [HM] [line 28, size 0, align 0, offset 0] [from ] 135!33 = metadata !{i32 786473, metadata !34} ; [ DW_TAG_file_type ] 136!34 = metadata !{metadata !"SingleSource/Benchmarks/Shootout-C++/hash.cpp", metadata !"SingleSource/Benchmarks/Shootout-C++"} 137