From a6bd9bd30eed9de2edf67ffb0fed336875c813ba Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 12 Aug 2014 01:07:53 +0000 Subject: [PATCH] DebugLocEntry: Restore the comparison predicate from before the refactoring in 215384. This way it can unique multiple entries describing the same piece even if they don't have the exact same location. (The same piece may get merged in and be added from OpenRanges). There ought to be a more elegant solution for this, though. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215418 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DebugLocEntry.h | 5 ++++- test/DebugInfo/X86/pieces-3.ll | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/lib/CodeGen/AsmPrinter/DebugLocEntry.h index a4e37e13841..c1c3a62cf89 100644 --- a/lib/CodeGen/AsmPrinter/DebugLocEntry.h +++ b/lib/CodeGen/AsmPrinter/DebugLocEntry.h @@ -131,7 +131,10 @@ public: // Remove any duplicate entries by dropping all but the first. void sortUniqueValues() { std::sort(Values.begin(), Values.end()); - Values.erase(std::unique(Values.begin(), Values.end()), Values.end()); + Values.erase(std::unique(Values.begin(), Values.end(), + [](const Value &A, const Value &B) { + return A.getVariable() == B.getVariable(); + }), Values.end()); } }; diff --git a/test/DebugInfo/X86/pieces-3.ll b/test/DebugInfo/X86/pieces-3.ll index cc5ead9194a..4ce7bea351d 100644 --- a/test/DebugInfo/X86/pieces-3.ll +++ b/test/DebugInfo/X86/pieces-3.ll @@ -44,6 +44,7 @@ define i32 @foo(i64 %outer.coerce0, i64 %outer.coerce1) #0 { call void @llvm.dbg.value(metadata !{i32 %outer.sroa.1.8.extract.trunc}, i64 0, metadata !34), !dbg !33 %outer.sroa.1.12.extract.shift = lshr i64 %outer.coerce1, 32, !dbg !33 %outer.sroa.1.12.extract.trunc = trunc i64 %outer.sroa.1.12.extract.shift to i32, !dbg !33 + call void @llvm.dbg.value(metadata !{i64 %outer.sroa.1.12.extract.shift}, i64 0, metadata !34), !dbg !33 call void @llvm.dbg.value(metadata !{i32 %outer.sroa.1.12.extract.trunc}, i64 0, metadata !34), !dbg !33 call void @llvm.dbg.declare(metadata !{null}, metadata !34), !dbg !33 ret i32 %outer.sroa.1.8.extract.trunc, !dbg !36