Skip to content

Commit d8b5af4

Browse files
Revert "Reland "Add a pass to collect dropped var stats for MIR" (#117044)"
This reverts commit 249755c. Broke https://lab.llvm.org/buildbot/#/builders/160/builds/9420 Note: This is test shard 99 of 154. [==========] Running 2 tests from 2 test suites. [----------] Global test environment set-up. [----------] 1 test from DroppedVariableStatsMIR [ RUN ] DroppedVariableStatsMIR.InlinedAt -- exit: -11
1 parent 5155322 commit d8b5af4

File tree

6 files changed

+3
-1193
lines changed

6 files changed

+3
-1193
lines changed

llvm/include/llvm/CodeGen/DroppedVariableStats.h

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
///===---------------------------------------------------------------------===//
88
/// \file
99
/// Dropped Variable Statistics for Debug Information. Reports any number
10-
/// of #dbg_values or DBG_VALUEs that get dropped due to an optimization pass.
10+
/// of #dbg_value that get dropped due to an optimization pass.
1111
///
1212
///===---------------------------------------------------------------------===//
1313

@@ -221,52 +221,6 @@ class DroppedVariableStatsIR : public DroppedVariableStats {
221221
}
222222
};
223223

224-
/// A class to collect and print dropped debug information due to MIR
225-
/// optimization passes. After every MIR pass is run, it will print how many
226-
/// #DBG_VALUEs were dropped due to that pass.
227-
class DroppedVariableStatsMIR : public DroppedVariableStats {
228-
public:
229-
DroppedVariableStatsMIR() : llvm::DroppedVariableStats(false) {}
230-
231-
void runBeforePass(StringRef PassID, MachineFunction *MF) {
232-
if (PassID == "Debug Variable Analysis")
233-
return;
234-
setup();
235-
return runOnMachineFunction(MF, true);
236-
}
237-
238-
void runAfterPass(StringRef PassID, MachineFunction *MF) {
239-
if (PassID == "Debug Variable Analysis")
240-
return;
241-
runOnMachineFunction(MF, false);
242-
calculateDroppedVarStatsOnMachineFunction(MF, PassID, MF->getName().str());
243-
cleanup();
244-
}
245-
246-
private:
247-
const MachineFunction *MFunc;
248-
/// Populate DebugVariablesBefore, DebugVariablesAfter, InlinedAts before or
249-
/// after a pass has run to facilitate dropped variable calculation for an
250-
/// llvm::MachineFunction.
251-
void runOnMachineFunction(const MachineFunction *MF, bool Before);
252-
/// Iterate over all Instructions in a MachineFunction and report any dropped
253-
/// debug information.
254-
void calculateDroppedVarStatsOnMachineFunction(const MachineFunction *MF,
255-
StringRef PassID,
256-
StringRef FuncOrModName);
257-
/// Override base class method to run on an llvm::MachineFunction
258-
/// specifically.
259-
virtual void
260-
visitEveryInstruction(unsigned &DroppedCount,
261-
DenseMap<VarID, DILocation *> &InlinedAtsMap,
262-
VarID Var) override;
263-
/// Override base class method to run on DBG_VALUEs specifically.
264-
virtual void visitEveryDebugRecord(
265-
DenseSet<VarID> &VarIDSet,
266-
DenseMap<StringRef, DenseMap<VarID, DILocation *>> &InlinedAtsMap,
267-
StringRef FuncName, bool Before) override;
268-
};
269-
270224
} // namespace llvm
271225

272226
#endif

llvm/include/llvm/CodeGen/MachineFunctionPass.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef LLVM_CODEGEN_MACHINEFUNCTIONPASS_H
1919
#define LLVM_CODEGEN_MACHINEFUNCTIONPASS_H
2020

21-
#include "llvm/CodeGen/DroppedVariableStats.h"
2221
#include "llvm/CodeGen/MachineFunction.h"
2322
#include "llvm/Pass.h"
2423

@@ -68,7 +67,6 @@ class MachineFunctionPass : public FunctionPass {
6867
MachineFunctionProperties RequiredProperties;
6968
MachineFunctionProperties SetProperties;
7069
MachineFunctionProperties ClearedProperties;
71-
DroppedVariableStatsMIR DroppedVarStatsMF;
7270

7371
/// createPrinterPass - Get a machine function printer pass.
7472
Pass *createPrinterPass(raw_ostream &O,

llvm/lib/CodeGen/DroppedVariableStats.cpp

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
///===---------------------------------------------------------------------===//
88
/// \file
99
/// Dropped Variable Statistics for Debug Information. Reports any number
10-
/// of #dbg_values or DBG_VALUEs that get dropped due to an optimization pass.
10+
/// of #dbg_value that get dropped due to an optimization pass.
1111
///
1212
///===---------------------------------------------------------------------===//
1313

@@ -192,64 +192,3 @@ void DroppedVariableStatsIR::visitEveryDebugRecord(
192192
}
193193
}
194194
}
195-
196-
void DroppedVariableStatsMIR::runOnMachineFunction(const MachineFunction *MF,
197-
bool Before) {
198-
auto &DebugVariables = DebugVariablesStack.back()[&MF->getFunction()];
199-
auto FuncName = MF->getName();
200-
MFunc = MF;
201-
run(DebugVariables, FuncName, Before);
202-
}
203-
204-
void DroppedVariableStatsMIR::calculateDroppedVarStatsOnMachineFunction(
205-
const MachineFunction *MF, StringRef PassID, StringRef FuncOrModName) {
206-
MFunc = MF;
207-
StringRef FuncName = MF->getName();
208-
const Function *Func = &MF->getFunction();
209-
DebugVariables &DbgVariables = DebugVariablesStack.back()[Func];
210-
calculateDroppedStatsAndPrint(DbgVariables, FuncName, PassID, FuncOrModName,
211-
"MachineFunction", Func);
212-
}
213-
214-
void DroppedVariableStatsMIR::visitEveryInstruction(
215-
unsigned &DroppedCount, DenseMap<VarID, DILocation *> &InlinedAtsMap,
216-
VarID Var) {
217-
unsigned PrevDroppedCount = DroppedCount;
218-
const DIScope *DbgValScope = std::get<0>(Var);
219-
for (const auto &MBB : *MFunc) {
220-
for (const auto &MI : MBB) {
221-
if (!MI.isDebugInstr()) {
222-
auto *DbgLoc = MI.getDebugLoc().get();
223-
if (!DbgLoc)
224-
continue;
225-
226-
auto *Scope = DbgLoc->getScope();
227-
if (updateDroppedCount(DbgLoc, Scope, DbgValScope, InlinedAtsMap, Var,
228-
DroppedCount))
229-
break;
230-
}
231-
}
232-
if (PrevDroppedCount != DroppedCount) {
233-
PrevDroppedCount = DroppedCount;
234-
break;
235-
}
236-
}
237-
}
238-
239-
void DroppedVariableStatsMIR::visitEveryDebugRecord(
240-
DenseSet<VarID> &VarIDSet,
241-
DenseMap<StringRef, DenseMap<VarID, DILocation *>> &InlinedAtsMap,
242-
StringRef FuncName, bool Before) {
243-
for (const auto &MBB : *MFunc) {
244-
for (const auto &MI : MBB) {
245-
if (MI.isDebugValueLike()) {
246-
auto *DbgVar = MI.getDebugVariable();
247-
if (!DbgVar)
248-
continue;
249-
auto DbgLoc = MI.getDebugLoc();
250-
populateVarIDSetAndInlinedMap(DbgVar, DbgLoc, VarIDSet, InlinedAtsMap,
251-
FuncName, Before);
252-
}
253-
}
254-
}
255-
}

llvm/lib/CodeGen/MachineFunctionPass.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
using namespace llvm;
3333
using namespace ore;
3434

35-
static cl::opt<bool> DroppedVarStatsMIR(
36-
"dropped-variable-stats-mir", cl::Hidden,
37-
cl::desc("Dump dropped debug variables stats for MIR passes"),
38-
cl::init(false));
39-
4035
Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O,
4136
const std::string &Banner) const {
4237
return createMachineFunctionPrinterPass(O, Banner);
@@ -96,15 +91,7 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
9691

9792
MFProps.reset(ClearedProperties);
9893

99-
bool RV;
100-
if (DroppedVarStatsMIR) {
101-
auto PassName = getPassName();
102-
DroppedVarStatsMF.runBeforePass(PassName, &MF);
103-
RV = runOnMachineFunction(MF);
104-
DroppedVarStatsMF.runAfterPass(PassName, &MF);
105-
} else {
106-
RV = runOnMachineFunction(MF);
107-
}
94+
bool RV = runOnMachineFunction(MF);
10895

10996
if (ShouldEmitSizeRemarks) {
11097
// We wanted size remarks. Check if there was a change to the number of

llvm/unittests/CodeGen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ add_llvm_unittest(CodeGenTests
2828
DIEHashTest.cpp
2929
DIETest.cpp
3030
DroppedVariableStatsIRTest.cpp
31-
DroppedVariableStatsMIRTest.cpp
3231
DwarfStringPoolEntryRefTest.cpp
3332
InstrRefLDVTest.cpp
3433
LowLevelTypeTest.cpp

0 commit comments

Comments
 (0)