[llvm] r215386 - Debug info: Modify DebugLocEntry::addValue to take multiple values so it
Adrian Prantl
aprantl at apple.com
Mon Aug 11 14:06:00 PDT 2014
Author: adrian
Date: Mon Aug 11 16:06:00 2014
New Revision: 215386
URL: http://llvm.org/viewvc/llvm-project?rev=215386&view=rev
Log:
Debug info: Modify DebugLocEntry::addValue to take multiple values so it
only has to sort/unique values once per batch.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h?rev=215386&r1=215385&r2=215386&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h Mon Aug 11 16:06:00 2014
@@ -114,8 +114,7 @@ public:
DIVariable NextVar(Next.Values[0].Variable);
if (Var.getName() == NextVar.getName() &&
Var.isVariablePiece() && NextVar.isVariablePiece()) {
- Values.append(Next.Values.begin(), Next.Values.end());
- sortUniqueValues();
+ addValues(Next.Values);
End = Next.End;
return true;
}
@@ -139,11 +138,12 @@ public:
const MCSymbol *getBeginSym() const { return Begin; }
const MCSymbol *getEndSym() const { return End; }
const ArrayRef<Value> getValues() const { return Values; }
- void addValue(Value Val) {
- assert(DIVariable(Val.Variable).isVariablePiece() &&
- "multi-value DebugLocEntries must be pieces");
- Values.push_back(Val);
+ void addValues(ArrayRef<DebugLocEntry::Value> Vals) {
+ Values.append(Vals.begin(), Vals.end());
sortUniqueValues();
+ assert(std::all_of(Values.begin(), Values.end(), [](DebugLocEntry::Value V){
+ return DIVariable(V.Variable).isVariablePiece();
+ }) && "value must be a piece");
}
// Sort the pieces by offset.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=215386&r1=215385&r2=215386&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Aug 11 16:06:00 2014
@@ -1288,8 +1288,9 @@ DwarfDebug::buildLocationList(SmallVecto
if (!couldMerge) {
// Need to add a new DebugLocEntry. Add all values from still
// valid non-overlapping pieces.
- for (auto Range : OpenRanges)
- Loc.addValue(Range.second);
+ if (OpenRanges.size())
+ Loc.addValues(OpenRanges);
+
DebugLoc.push_back(std::move(Loc));
}
More information about the llvm-commits
mailing list