aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2021-06-01 12:38:32 -0700
committerSriraman Tallam <tmsriram@google.com>2021-06-01 21:59:47 -0700
commit516e5bb2b11ea374e5a468b7fb17b0c4e9f1b863 (patch)
tree80cdca1018e4dbbffaa65a70c200b50469053b39 /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
parent251a5d9d5239c0402e0ab68718aa194c2b4f04bb (diff)
downloadllvm-516e5bb2b11ea374e5a468b7fb17b0c4e9f1b863.zip
llvm-516e5bb2b11ea374e5a468b7fb17b0c4e9f1b863.tar.gz
llvm-516e5bb2b11ea374e5a468b7fb17b0c4e9f1b863.tar.bz2
Resubmit D85085 after fixing the tests that were failing.
D85085 was pushed earlier but broke tests on mac and win: http://lab.llvm.org:8080/green/job/clang-stage1-RA/21182/consoleFull#-706149783d489585b-5106-414a-ac11-3ff90657619c Recommitting it after adding mtriple to the llc commands. Emit correct location lists with basic block sections. This patch addresses multiple things: 1) It ensures that const_value is emitted when possible with basic block sections. 2) It emits location lists such that the labels are always within the section boundary. 3) It fixes a bug when the parameter is first used in a non-entry block which is in a different section from the entry block. Differential Revision: https://reviews.llvm.org/D85085
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index 70a4d5f..c81288c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -290,16 +290,10 @@ void DebugHandlerBase::beginFunction(const MachineFunction *MF) {
// doing that violates the ranges that are calculated in the history map.
// However, we currently do not emit debug values for constant arguments
// directly at the start of the function, so this code is still useful.
- // FIXME: If the first mention of an argument is in a unique section basic
- // block, we cannot always assign the CurrentFnBeginLabel as it lies in a
- // different section. Temporarily, we disable generating loc list
- // information or DW_AT_const_value when the block is in a different
- // section.
const DILocalVariable *DIVar =
Entries.front().getInstr()->getDebugVariable();
if (DIVar->isParameter() &&
- getDISubprogram(DIVar->getScope())->describes(&MF->getFunction()) &&
- Entries.front().getInstr()->getParent()->sameSection(&MF->front())) {
+ getDISubprogram(DIVar->getScope())->describes(&MF->getFunction())) {
if (!IsDescribedByReg(Entries.front().getInstr()))
LabelsBeforeInsn[Entries.front().getInstr()] = Asm->getFunctionBegin();
if (Entries.front().getInstr()->getDebugExpression()->isFragment()) {
@@ -385,22 +379,25 @@ void DebugHandlerBase::endInstruction() {
DenseMap<const MachineInstr *, MCSymbol *>::iterator I =
LabelsAfterInsn.find(CurMI);
- CurMI = nullptr;
- // No label needed.
- if (I == LabelsAfterInsn.end())
- return;
-
- // Label already assigned.
- if (I->second)
+ // No label needed or label already assigned.
+ if (I == LabelsAfterInsn.end() || I->second) {
+ CurMI = nullptr;
return;
+ }
- // We need a label after this instruction.
- if (!PrevLabel) {
+ // We need a label after this instruction. With basic block sections, just
+ // use the end symbol of the section if this is the last instruction of the
+ // section. This reduces the need for an additional label and also helps
+ // merging ranges.
+ if (CurMI->getParent()->isEndSection() && CurMI->getNextNode() == nullptr) {
+ PrevLabel = CurMI->getParent()->getEndSymbol();
+ } else if (!PrevLabel) {
PrevLabel = MMI->getContext().createTempSymbol();
Asm->OutStreamer->emitLabel(PrevLabel);
}
I->second = PrevLabel;
+ CurMI = nullptr;
}
void DebugHandlerBase::endFunction(const MachineFunction *MF) {