Skip to content

Commit e0f21a4

Browse files
[LiveDebugValues] Remove swift customizations introducing entry values
With the new approach to entry values, codegen no longer needs to get involved, so these LDV customizations are no longer needed. These were particularly problematic as they were re-introducing entry values in the "entry funclet" of certain swift async functions. (cherry picked from commit 56252e3)
1 parent b41a79e commit e0f21a4

File tree

7 files changed

+2
-1210
lines changed

7 files changed

+2
-1210
lines changed

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,6 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {
14201420

14211421
// MLocTracker needs to know that this register is read, even if it's only
14221422
// read by a debug inst.
1423-
bool convertToSwiftAsyncEntryValue = false;
14241423
for (const MachineOperand &MO : MI.debug_operands())
14251424
if (MO.isReg() && MO.getReg() != 0) {
14261425
ValueIDNum RegId = MTracker->readReg(MO.getReg());
@@ -1438,17 +1437,9 @@ bool InstrRefBasedLDV::transferDebugValue(const MachineInstr &MI) {
14381437
if (!Expr || !Expr->isEntryValue()) {
14391438
if (TTracker)
14401439
TTracker->recoverAsEntryValue(V, Properties, RegId);
1441-
else
1442-
convertToSwiftAsyncEntryValue = true;
14431440
}
14441441
}
14451442
}
1446-
1447-
if (convertToSwiftAsyncEntryValue && Expr && !MI.isDebugValueList()) {
1448-
const_cast<MachineInstr *>(&MI)->getOperand(3).setMetadata(
1449-
DIExpression::prepend(Expr, DIExpression::EntryValue));
1450-
Properties.DIExpr = MI.getDebugExpression();
1451-
}
14521443
// END SWIFT
14531444

14541445
// If we're preparing for the second analysis (variables), the machine value

llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,40 +2293,11 @@ bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF,
22932293

22942294
// Only in the case of entry MBB collect DBG_VALUEs representing
22952295
// function parameters in order to generate debug entry values for them.
2296-
SmallVector<MachineInstr *, 8> AsyncDbgValues;
22972296
MachineBasicBlock &First_MBB = *(MF.begin());
2298-
// Use a cache so that we only hoist the first swift async context debug inst
2299-
// for a specific DBG_VALUE. Otherwise, we may hoist inappropriately over a
2300-
// llvm.dbg.value.
2301-
SmallDenseSet<DebugVariable, 8> SeenDebugVars;
23022297
for (auto &MI : First_MBB) {
23032298
collectRegDefs(MI, DefinedRegs, TRI);
2304-
if (MI.isDebugValue()) {
2305-
// In Swift async functions entry values are preferred, since they
2306-
// can be evaluated in both live frames and virtual backtraces.
2307-
if (SeenDebugVars
2308-
.insert(DebugVariable(MI.getDebugVariable(),
2309-
MI.getDebugExpression(),
2310-
MI.getDebugLoc()->getInlinedAt()))
2311-
.second &&
2312-
isSwiftAsyncContext(MI) && !MI.isDebugValueList()) {
2313-
// If our instruction is not an entry value yet, make it an entry value.
2314-
if (!MI.getDebugExpression()->isEntryValue()) {
2315-
MI.getOperand(3).setMetadata(DIExpression::prepend(
2316-
MI.getDebugExpression(), DIExpression::EntryValue));
2317-
}
2318-
AsyncDbgValues.push_back(&MI);
2319-
} else {
2320-
recordEntryValue(MI, DefinedRegs, OpenRanges, VarLocIDs);
2321-
}
2322-
}
2323-
}
2324-
2325-
if (AsyncDbgValues.size()) {
2326-
// Make sure the async entry values are at the very start.
2327-
auto InsertPt = First_MBB.getFirstNonDebugInstr();
2328-
for (auto *MI : llvm::reverse(AsyncDbgValues))
2329-
MI->moveBefore(&*InsertPt);
2299+
if (MI.isDebugValue())
2300+
recordEntryValue(MI, DefinedRegs, OpenRanges, VarLocIDs);
23302301
}
23312302

23322303
// Initialize per-block structures and scan for fragment overlaps.

llvm/test/DebugInfo/AArch64/swift-async.ll

Lines changed: 0 additions & 188 deletions
This file was deleted.

0 commit comments

Comments
 (0)