Revert 54a61c94f9 and its follow up in 547b712500

These were part of D107823, however asan  has found something excitingly
wrong happening:

https://lab.llvm.org/buildbot/#/builders/5/builds/10543/steps/13/logs/stdio
This commit is contained in:
Jeremy Morse committed 2021-08-16 15:48:56 +01:00
1 parent de285eacb0
commit 95fe61e639
5 files changed
+20 -60

No files matched your search

@@ -1684,8 +1684,7 @@ private:
/// RPOT block ordering.
void initialSetup(MachineFunction &MF);
bool ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
unsigned InputBBLimit, unsigned InputDbgValLimit) override;
bool ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC) override;
public:
/// Default construct and initialize the pass.
@@ -3524,9 +3523,8 @@ void InstrRefBasedLDV::initialSetup(MachineFunction &MF) {
/// Calculate the liveness information for the given machine function and
/// extend ranges across basic blocks.
bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
unsigned InputBBLimit,
unsigned InputDbgValLimit) {
bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
TargetPassConfig *TPC) {
// No subprogram means this function contains no debuginfo.
if (!MF.getFunction().getSubprogram())
return false;
@@ -3628,7 +3626,6 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
// To mirror old LiveDebugValues, enumerate variables in RPOT order. Otherwise
// the order is unimportant, it just has to be stable.
unsigned VarAssignCount = 0;
for (unsigned int I = 0; I < OrderToBB.size(); ++I) {
auto *MBB = OrderToBB[I];
auto *VTracker = &vlocs[MBB->getNumber()];
@@ -3646,21 +3643,9 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
ScopeToVars[Scope].insert(Var);
ScopeToBlocks[Scope].insert(VTracker->MBB);
ScopeToDILocation[Scope] = ScopeLoc;
++VarAssignCount;
}
}
// If we have an extremely large number of variable assignments and blocks,
// bail out at this point. We've burnt some time doing analysis already,
// however we should cut our losses.
if (MaxNumBlocks > (int)InputBBLimit && VarAssignCount > InputDbgValLimit) {
LLVM_DEBUG(dbgs() << "Disabling InstrRefBasedLDV: " << MF.getName()
<< " has " << MaxNumBlocks << " basic blocks and "
<< VarAssignCount
<< " variable assignments, exceeding limits.\n");
return false;
}
// OK. Iterate over scopes: there might be something to be said for
// ordering them by size/locality, but that's for the future. For each scope,
// solve the variable value problem, producing a map of variables to values
@@ -40,18 +40,6 @@ static cl::opt<bool>
"normal DBG_VALUE inputs"),
cl::init(false));
// Options to prevent pathological compile-time behavior. If InputBBLimit and
// InputDbgValueLimit are both exceeded, range extension is disabled.
static cl::opt<unsigned> InputBBLimit(
"livedebugvalues-input-bb-limit",
cl::desc("Maximum input basic blocks before DBG_VALUE limit applies"),
cl::init(10000), cl::Hidden);
static cl::opt<unsigned> InputDbgValueLimit(
"livedebugvalues-input-dbg-value-limit",
cl::desc(
"Maximum input DBG_VALUE insts supported by debug range extension"),
cl::init(50000), cl::Hidden);
/// Generic LiveDebugValues pass. Calls through to VarLocBasedLDV or
/// InstrRefBasedLDV to perform location propagation, via the LDVImpl
/// base class.
@@ -115,5 +103,5 @@ bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) {
TheImpl = llvm::makeVarLocBasedLiveDebugValues();
}
return TheImpl->ExtendRanges(MF, TPC, InputBBLimit, InputDbgValueLimit);
return TheImpl->ExtendRanges(MF, TPC);
}
@@ -23,9 +23,7 @@ inline namespace SharedLiveDebugValues {
// implementation.
class LDVImpl {
public:
virtual bool ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
unsigned InputBBLimit,
unsigned InputDbgValLimit) = 0;
virtual bool ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC) = 0;
virtual ~LDVImpl() {}
};
@@ -166,6 +166,18 @@ using namespace llvm;
STATISTIC(NumInserted, "Number of DBG_VALUE instructions inserted");
// Options to prevent pathological compile-time behavior. If InputBBLimit and
// InputDbgValueLimit are both exceeded, range extension is disabled.
static cl::opt<unsigned> InputBBLimit(
"livedebugvalues-input-bb-limit",
cl::desc("Maximum input basic blocks before DBG_VALUE limit applies"),
cl::init(10000), cl::Hidden);
static cl::opt<unsigned> InputDbgValueLimit(
"livedebugvalues-input-dbg-value-limit",
cl::desc(
"Maximum input DBG_VALUE insts supported by debug range extension"),
cl::init(50000), cl::Hidden);
/// If \p Op is a stack or frame register return true, otherwise return false.
/// This is used to avoid basing the debug entry values on the registers, since
/// we do not support it at the moment.
@@ -995,8 +1007,7 @@ private:
/// had their instruction creation deferred.
void flushPendingLocs(VarLocInMBB &PendingInLocs, VarLocMap &VarLocIDs);
bool ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
unsigned InputBBLimit, unsigned InputDbgValLimit) override;
bool ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC) override;
public:
/// Default construct and initialize the pass.
@@ -2037,9 +2048,7 @@ void VarLocBasedLDV::recordEntryValue(const MachineInstr &MI,
/// Calculate the liveness information for the given machine function and
/// extend ranges across basic blocks.
bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
unsigned InputBBLimit,
unsigned InputDbgValLimit) {
bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC) {
LLVM_DEBUG(dbgs() << "\nDebug Range Extension\n");
if (!MF.getFunction().getSubprogram())
@@ -2132,7 +2141,7 @@ bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF, TargetPassConfig *TPC,
for (auto &MI : MBB)
if (MI.isDebugValue())
++NumInputDbgValues;
if (NumInputDbgValues > InputDbgValLimit) {
if (NumInputDbgValues > InputDbgValueLimit) {
LLVM_DEBUG(dbgs() << "Disabling VarLocBasedLDV: " << MF.getName()
<< " has " << RPONumber << " basic blocks and "
<< NumInputDbgValues
@@ -5,41 +5,21 @@
# RUN: -livedebugvalues-input-bb-limit=1 \
# RUN: -livedebugvalues-input-dbg-value-limit=1 \
# RUN: | FileCheck %s -check-prefix=LDV-DISABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -experimental-debug-variable-locations \
# RUN: -livedebugvalues-input-bb-limit=1 \
# RUN: -livedebugvalues-input-dbg-value-limit=1 \
# RUN: | FileCheck %s -check-prefix=LDV-DISABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -livedebugvalues-input-bb-limit=1 \
# RUN: -livedebugvalues-input-dbg-value-limit=10 \
# RUN: | FileCheck %s -check-prefix=LDV-ENABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -experimental-debug-variable-locations \
# RUN: -livedebugvalues-input-bb-limit=1 \
# RUN: -livedebugvalues-input-dbg-value-limit=10 \
# RUN: | FileCheck %s -check-prefix=LDV-ENABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -livedebugvalues-input-bb-limit=10 \
# RUN: -livedebugvalues-input-dbg-value-limit=1 \
# RUN: | FileCheck %s -check-prefix=LDV-ENABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -experimental-debug-variable-locations \
# RUN: -livedebugvalues-input-bb-limit=10 \
# RUN: -livedebugvalues-input-dbg-value-limit=1 \
# RUN: | FileCheck %s -check-prefix=LDV-ENABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -livedebugvalues-input-bb-limit=10 \
# RUN: -livedebugvalues-input-dbg-value-limit=10 \
# RUN: | FileCheck %s -check-prefix=LDV-ENABLED
# RUN: llc %s -o - -run-pass=livedebugvalues -mtriple=x86_64-unknown-unknown \
# RUN: -experimental-debug-variable-locations \
# RUN: -livedebugvalues-input-bb-limit=10 \
# RUN: -livedebugvalues-input-dbg-value-limit=10 \
# RUN: | FileCheck %s -check-prefix=LDV-ENABLED
# LDV-DISABLED-LABEL: bb.1.exit
# LDV-DISABLED-NEXT: $edi = MOV32rm