Skip to content

Commit b6cca0e

Browse files
committed
Revert "[DWARF] Add cuttoff guarding quadratic validThroughout behaviour"
This reverts commit b9d977b. This cutoff is no longer required. The commit 34ffa7fc501 (D86153) introduces a performance improvement which was tested against the motivating case for this patch. Discussed in differential revision: https://reviews.llvm.org/D86153
1 parent 57d8aca commit b6cca0e

File tree

3 files changed

+8
-97
lines changed

3 files changed

+8
-97
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ static cl::opt<LinkageNameOption>
148148
"Abstract subprograms")),
149149
cl::init(DefaultLinkageNames));
150150

151-
static cl::opt<unsigned> LocationAnalysisSizeLimit(
152-
"singlevarlocation-input-bb-limit",
153-
cl::desc("Maximum block size to analyze for single-location variables"),
154-
cl::init(30000), cl::Hidden);
155-
156151
static const char *const DWARFGroupName = "dwarf";
157152
static const char *const DWARFGroupDescription = "DWARF Emission";
158153
static const char *const DbgTimerName = "writer";
@@ -1611,10 +1606,8 @@ static bool validThroughout(LexicalScopes &LScopes,
16111606
// [1-3) [(reg0, fragment 0, 32), (reg1, fragment 32, 32)]
16121607
// [3-4) [(reg1, fragment 32, 32), (123, fragment 64, 32)]
16131608
// [4-) [(@g, fragment 0, 96)]
1614-
bool DwarfDebug::buildLocationList(
1615-
SmallVectorImpl<DebugLocEntry> &DebugLoc,
1616-
const DbgValueHistoryMap::Entries &Entries,
1617-
DenseSet<const MachineBasicBlock *> &VeryLargeBlocks) {
1609+
bool DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
1610+
const DbgValueHistoryMap::Entries &Entries) {
16181611
using OpenRange =
16191612
std::pair<DbgValueHistoryMap::EntryIndex, DbgValueLoc>;
16201613
SmallVector<OpenRange, 4> OpenRanges;
@@ -1710,14 +1703,8 @@ bool DwarfDebug::buildLocationList(
17101703
DebugLoc.pop_back();
17111704
}
17121705

1713-
// If there's a single entry, safe for a single location, and not part of
1714-
// an over-sized basic block, then ask validThroughout whether this
1715-
// location can be represented as a single variable location.
1716-
if (DebugLoc.size() != 1 || !isSafeForSingleLocation)
1717-
return false;
1718-
if (VeryLargeBlocks.count(StartDebugMI->getParent()))
1719-
return false;
1720-
return validThroughout(LScopes, StartDebugMI, EndMI, getInstOrdering());
1706+
return DebugLoc.size() == 1 && isSafeForSingleLocation &&
1707+
validThroughout(LScopes, StartDebugMI, EndMI, getInstOrdering());
17211708
}
17221709

17231710
DbgEntity *DwarfDebug::createConcreteEntity(DwarfCompileUnit &TheCU,
@@ -1749,13 +1736,6 @@ void DwarfDebug::collectEntityInfo(DwarfCompileUnit &TheCU,
17491736
// Grab the variable info that was squirreled away in the MMI side-table.
17501737
collectVariableInfoFromMFTable(TheCU, Processed);
17511738

1752-
// Identify blocks that are unreasonably sized, so that we can later
1753-
// skip lexical scope analysis over them.
1754-
DenseSet<const MachineBasicBlock *> VeryLargeBlocks;
1755-
for (const auto &MBB : *CurFn)
1756-
if (MBB.size() > LocationAnalysisSizeLimit)
1757-
VeryLargeBlocks.insert(&MBB);
1758-
17591739
for (const auto &I : DbgValues) {
17601740
InlinedEntity IV = I.first;
17611741
if (Processed.count(IV))
@@ -1792,8 +1772,7 @@ void DwarfDebug::collectEntityInfo(DwarfCompileUnit &TheCU,
17921772
if (HistSize == 1 || SingleValueWithClobber) {
17931773
const auto *End =
17941774
SingleValueWithClobber ? HistoryMapEntries[1].getInstr() : nullptr;
1795-
if (VeryLargeBlocks.count(MInsn->getParent()) == 0 &&
1796-
validThroughout(LScopes, MInsn, End, getInstOrdering())) {
1775+
if (validThroughout(LScopes, MInsn, End, getInstOrdering())) {
17971776
RegVar->initializeDbgValue(MInsn);
17981777
continue;
17991778
}
@@ -1808,8 +1787,7 @@ void DwarfDebug::collectEntityInfo(DwarfCompileUnit &TheCU,
18081787

18091788
// Build the location list for this variable.
18101789
SmallVector<DebugLocEntry, 8> Entries;
1811-
bool isValidSingleLocation =
1812-
buildLocationList(Entries, HistoryMapEntries, VeryLargeBlocks);
1790+
bool isValidSingleLocation = buildLocationList(Entries, HistoryMapEntries);
18131791

18141792
// Check whether buildLocationList managed to merge all locations to one
18151793
// that is valid throughout the variable's scope. If so, produce single

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,8 @@ class DwarfDebug : public DebugHandlerBase {
598598
/// function that describe the same variable. If the resulting
599599
/// list has only one entry that is valid for entire variable's
600600
/// scope return true.
601-
bool buildLocationList(
602-
SmallVectorImpl<DebugLocEntry> &DebugLoc,
603-
const DbgValueHistoryMap::Entries &Entries,
604-
DenseSet<const MachineBasicBlock *> &VeryLargeBlocks);
601+
bool buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
602+
const DbgValueHistoryMap::Entries &Entries);
605603

606604
/// Collect variable information from the side table maintained by MF.
607605
void collectVariableInfoFromMFTable(DwarfCompileUnit &TheCU,

llvm/test/DebugInfo/MIR/X86/singlelocation-cutoffs.mir

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

0 commit comments

Comments
 (0)