summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-16 18:04:22 +0000
committerdim <dim@FreeBSD.org>2016-01-16 18:04:22 +0000
commit815e5f1f978136bee97bf5c67ef44123ac294ab1 (patch)
tree09ecf9adfe3fdc2be049d6954de08996356830a9 /contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parenta49d5469df472d80c9cc17394c71fa8244e6a759 (diff)
downloadFreeBSD-src-815e5f1f978136bee97bf5c67ef44123ac294ab1.zip
FreeBSD-src-815e5f1f978136bee97bf5c67ef44123ac294ab1.tar.gz
Pull in r257977 from upstream llvm trunk, by Keno Fischer:
[DwarfDebug] Move MergeValues to .cpp, NFC Pull in r257979 from upstream llvm trunk, by Keno Fischer: [DwarfDebug] Don't merge DebugLocEntries if their pieces overlap Summary: Later in DWARF emission we check that DebugLocEntries have non-overlapping pieces, so we should create any such entries by merging here. Fixes PR26163. Reviewers: aprantl Differential Revision: http://reviews.llvm.org/D16249 Again, these will be merged to the official release_38 branch soon, but we need them ASAP.
Diffstat (limited to 'contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a4fb07e..ae62b6b 100644
--- a/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -805,6 +805,24 @@ static bool piecesOverlap(const DIExpression *P1, const DIExpression *P2) {
return (l1 < r2) && (l2 < r1);
}
+/// \brief If this and Next are describing different pieces of the same
+/// variable, merge them by appending Next's values to the current
+/// list of values.
+/// Return true if the merge was successful.
+bool DebugLocEntry::MergeValues(const DebugLocEntry &Next) {
+ if (Begin == Next.Begin) {
+ auto *Expr = cast_or_null<DIExpression>(Values[0].Expression);
+ auto *NextExpr = cast_or_null<DIExpression>(Next.Values[0].Expression);
+ if (Expr->isBitPiece() && NextExpr->isBitPiece() &&
+ !piecesOverlap(Expr, NextExpr)) {
+ addValues(Next.Values);
+ End = Next.End;
+ return true;
+ }
+ }
+ return false;
+}
+
/// Build the location list for all DBG_VALUEs in the function that
/// describe the same variable. If the ranges of several independent
/// pieces of the same variable overlap partially, split them up and
OpenPOWER on IntegriCloud