diff options
author | Andrew Trick <atrick@apple.com> | 2012-12-05 21:37:50 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-12-05 21:37:50 +0000 |
commit | f3329c419b1010089e8aaf3d43b811ba12d94c8a (patch) | |
tree | 07bf22c5a067653e6364ba6e3a8cd43cdeaf5306 | |
parent | f54f61538688eff25f392c2062b3a654394333aa (diff) | |
download | llvm-f3329c419b1010089e8aaf3d43b811ba12d94c8a.tar.gz llvm-f3329c419b1010089e8aaf3d43b811ba12d94c8a.tar.bz2 llvm-f3329c419b1010089e8aaf3d43b811ba12d94c8a.tar.xz |
RegisterPressureTracker: fix findUseBetween to handle DebugValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169427 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/RegisterPressure.cpp | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/2012-11-30-misched-dbg.ll | 49 |
2 files changed, 51 insertions, 0 deletions
diff --git a/lib/CodeGen/RegisterPressure.cpp b/lib/CodeGen/RegisterPressure.cpp index 1576b2abbe..c7859b9395 100644 --- a/lib/CodeGen/RegisterPressure.cpp +++ b/lib/CodeGen/RegisterPressure.cpp @@ -680,6 +680,8 @@ static bool findUseBetween(unsigned Reg, UI = MRI->use_nodbg_begin(Reg), UE = MRI->use_nodbg_end(); UI != UE; UI.skipInstruction()) { const MachineInstr* MI = &*UI; + if (MI->isDebugValue()) + continue; SlotIndex InstSlot = LIS->getInstructionIndex(MI).getRegSlot(); if (InstSlot >= PriorUseIdx && InstSlot < NextUseIdx) return true; diff --git a/test/CodeGen/X86/2012-11-30-misched-dbg.ll b/test/CodeGen/X86/2012-11-30-misched-dbg.ll index c143240067..f171c16df3 100644 --- a/test/CodeGen/X86/2012-11-30-misched-dbg.ll +++ b/test/CodeGen/X86/2012-11-30-misched-dbg.ll @@ -83,3 +83,52 @@ declare i32 @__sprintf_chk(i8*, i32, i64, i8*, ...) !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] !17 = metadata !{metadata !18} !18 = metadata !{i32 786465, i64 0, i64 20} ; [ DW_TAG_subrange_type ] [0, 19] + +; Test DebugValue uses visited by RegisterPressureTracker findUseBetween(). +; +; CHECK: @main +; CHECK: DEBUG_VALUE: X +; CHECK: call + +%"class.__gnu_cxx::hash_map" = type { %"class.__gnu_cxx::hashtable" } +%"class.__gnu_cxx::hashtable" = type { i64, i64, i64, i64, i64, i64 } + +define void @main() uwtable ssp { +entry: + %X = alloca %"class.__gnu_cxx::hash_map", align 8 + br i1 undef, label %cond.true, label %cond.end + +cond.true: ; preds = %entry + unreachable + +cond.end: ; preds = %entry + call void @llvm.dbg.declare(metadata !{%"class.__gnu_cxx::hash_map"* %X}, metadata !21) + %_M_num_elements.i.i.i.i = getelementptr inbounds %"class.__gnu_cxx::hash_map"* %X, i64 0, i32 0, i32 5 + invoke void @_Znwm() + to label %exit.i unwind label %lpad2.i.i.i.i + +exit.i: ; preds = %cond.end + unreachable + +lpad2.i.i.i.i: ; preds = %cond.end + %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + cleanup + br i1 undef, label %lpad.body.i.i, label %if.then.i.i.i.i.i.i.i.i + +if.then.i.i.i.i.i.i.i.i: ; preds = %lpad2.i.i.i.i + unreachable + +lpad.body.i.i: ; preds = %lpad2.i.i.i.i + resume { i8*, i32 } %0 +} + +declare i32 @__gxx_personality_v0(...) + +declare void @_Znwm() + +!llvm.dbg.cu = !{!20} + +!20 = 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] +!21 = metadata !{i32 786688, null, metadata !"X", null, i32 29, metadata !22, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [X] [line 29] +!22 = metadata !{i32 786454, null, metadata !"HM", metadata !23, i32 28, i64 0, i64 0, i64 0, i32 0, null} ; [ DW_TAG_typedef ] [HM] [line 28, size 0, align 0, offset 0] [from ] +!23 = metadata !{i32 786473, metadata !"SingleSource/Benchmarks/Shootout-C++/hash.cpp", metadata !"SingleSource/Benchmarks/Shootout-C++", null} ; [ DW_TAG_file_type ] |