X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FCodeGen%2FAsmPrinter%2FDwarfDebug.cpp;h=ae62b6b19a4298773476da93fa23d5497ab6ce93;hp=a4fb07eacb3bbf3ab43857b6fbc59d71fabe4066;hb=770ec8cf9ae215e26cb6d946b9d533151fe0558d;hpb=d26a2e75e58f56a289b911c0bf582be4f8f655f1;ds=sidebyside diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index a4fb07eacb3..ae62b6b19a4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/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(Values[0].Expression); + auto *NextExpr = cast_or_null(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