Skip to content

[LiveDebugValues] Remove swift customizations introducing entry values #7715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,6 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {

// MLocTracker needs to know that this register is read, even if it's only
// read by a debug inst.
bool convertToSwiftAsyncEntryValue = false;
for (const MachineOperand &MO : MI.debug_operands())
if (MO.isReg() && MO.getReg() != 0) {
ValueIDNum RegId = MTracker->readReg(MO.getReg());
Expand All @@ -1438,17 +1437,9 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {
if (!Expr || !Expr->isEntryValue()) {
if (TTracker)
TTracker->recoverAsEntryValue(V, Properties, RegId);
else
convertToSwiftAsyncEntryValue = true;
}
}
}

if (convertToSwiftAsyncEntryValue && Expr && !MI.isDebugValueList()) {
const_cast<MachineInstr *>(&MI)->getOperand(3).setMetadata(
DIExpression::prepend(Expr, DIExpression::EntryValue));
Properties.DIExpr = MI.getDebugExpression();
}
// END SWIFT

// If we're preparing for the second analysis (variables), the machine value
Expand Down
33 changes: 2 additions & 31 deletions llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2293,40 +2293,11 @@ bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF,

// Only in the case of entry MBB collect DBG_VALUEs representing
// function parameters in order to generate debug entry values for them.
SmallVector<MachineInstr *, 8> AsyncDbgValues;
MachineBasicBlock &First_MBB = *(MF.begin());
// Use a cache so that we only hoist the first swift async context debug inst
// for a specific DBG_VALUE. Otherwise, we may hoist inappropriately over a
// llvm.dbg.value.
SmallDenseSet<DebugVariable, 8> SeenDebugVars;
for (auto &MI : First_MBB) {
collectRegDefs(MI, DefinedRegs, TRI);
if (MI.isDebugValue()) {
// In Swift async functions entry values are preferred, since they
// can be evaluated in both live frames and virtual backtraces.
if (SeenDebugVars
.insert(DebugVariable(MI.getDebugVariable(),
MI.getDebugExpression(),
MI.getDebugLoc()->getInlinedAt()))
.second &&
isSwiftAsyncContext(MI) && !MI.isDebugValueList()) {
// If our instruction is not an entry value yet, make it an entry value.
if (!MI.getDebugExpression()->isEntryValue()) {
MI.getOperand(3).setMetadata(DIExpression::prepend(
MI.getDebugExpression(), DIExpression::EntryValue));
}
AsyncDbgValues.push_back(&MI);
} else {
recordEntryValue(MI, DefinedRegs, OpenRanges, VarLocIDs);
}
}
}

if (AsyncDbgValues.size()) {
// Make sure the async entry values are at the very start.
auto InsertPt = First_MBB.getFirstNonDebugInstr();
for (auto *MI : llvm::reverse(AsyncDbgValues))
MI->moveBefore(&*InsertPt);
if (MI.isDebugValue())
recordEntryValue(MI, DefinedRegs, OpenRanges, VarLocIDs);
}

// Initialize per-block structures and scan for fragment overlaps.
Expand Down
188 changes: 0 additions & 188 deletions llvm/test/DebugInfo/AArch64/swift-async.ll

This file was deleted.

Loading