aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
diff options
context:
space:
mode:
authorDavid Stenberg <david.stenberg@ericsson.com>2019-05-28 13:23:25 +0000
committerDavid Stenberg <david.stenberg@ericsson.com>2019-05-28 13:23:25 +0000
commit5d0e6b6755da38084809d38bf527164a7f285ecd (patch)
tree0603f89dc3768a237a91e34d25b63a4158abb4ae /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
parentd3ed418ad3c4bd233b926e586888e177d4fa82be (diff)
downloadllvm-5d0e6b6755da38084809d38bf527164a7f285ecd.zip
llvm-5d0e6b6755da38084809d38bf527164a7f285ecd.tar.gz
llvm-5d0e6b6755da38084809d38bf527164a7f285ecd.tar.bz2
Stop undef fragments from closing non-overlapping fragments
Summary: When DwarfDebug::buildLocationList() encountered an undef debug value, it would truncate all open values, regardless if they were overlapping or not. This patch fixes so that it only does that for overlapping fragments. This change unearthed a bug that I had introduced in D57511, which I have fixed in this patch. The code in DebugHandlerBase that changes labels for parameter debug values could break DwarfDebug's assumption that the labels for the entries in the debug value history are monotonically increasing. Before this patch, that bug could result in location list entries whose ending address was lower than the beginning address, and with the changes for undef debug values that this patch introduces it could trigger an assertion, due to attempting to emit location list entries with empty ranges. A reproducer for the bug is added in param-reg-const-mix.mir. Reviewers: aprantl, jmorse, probinson Reviewed By: aprantl Subscribers: javed.absar, llvm-commits Tags: #debug-info, #llvm Differential Revision: https://reviews.llvm.org/D62379 llvm-svn: 361820
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index 22c28cc..22f458e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -246,8 +246,13 @@ void DebugHandlerBase::beginFunction(const MachineFunction *MF) {
Pred.getInstr()->getDebugExpression());
}))
break;
- if (!IsDescribedByReg(I->getInstr()))
- LabelsBeforeInsn[I->getInstr()] = Asm->getFunctionBegin();
+ // The code that generates location lists for DWARF assumes that the
+ // entries' start labels are monotonically increasing, and since we
+ // don't change the label for fragments that are described by
+ // registers, we must bail out when encountering such a fragment.
+ if (IsDescribedByReg(I->getInstr()))
+ break;
+ LabelsBeforeInsn[I->getInstr()] = Asm->getFunctionBegin();
}
}
}