summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunctionPass.cpp
diff options
context:
space:
mode:
authorShubham Sandeep Rastogi <srastogi22@apple.com>2024-12-03 12:37:30 -0800
committerGitHub <noreply@github.com>2024-12-03 12:37:30 -0800
commit249755cedb17ffa707253edcef1a388f807caa35 (patch)
tree92b3fcfd7da870111e897269d15bb822fa574dff /llvm/lib/CodeGen/MachineFunctionPass.cpp
parenta0c4f854cad2b97e44a1b58dc1fd982e1c4d60f3 (diff)
Reland "Add a pass to collect dropped var stats for MIR" (#117044)
Moved the MIR Test to the unittests/CodeGen folder This is patch is part of a stack of patches, and follows https://github.com/llvm/llvm-project/pull/117042 I moved the MIR test to the unittests/CodeGen folder I am trying to reland https://github.com/llvm/llvm-project/pull/115566
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunctionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunctionPass.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index 62ac3e32d24d..e803811643f8 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -32,6 +32,11 @@
using namespace llvm;
using namespace ore;
+static cl::opt<bool> DroppedVarStatsMIR(
+ "dropped-variable-stats-mir", cl::Hidden,
+ cl::desc("Dump dropped debug variables stats for MIR passes"),
+ cl::init(false));
+
Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O,
const std::string &Banner) const {
return createMachineFunctionPrinterPass(O, Banner);
@@ -91,7 +96,15 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
MFProps.reset(ClearedProperties);
- bool RV = runOnMachineFunction(MF);
+ bool RV;
+ if (DroppedVarStatsMIR) {
+ auto PassName = getPassName();
+ DroppedVarStatsMF.runBeforePass(PassName, &MF);
+ RV = runOnMachineFunction(MF);
+ DroppedVarStatsMF.runAfterPass(PassName, &MF);
+ } else {
+ RV = runOnMachineFunction(MF);
+ }
if (ShouldEmitSizeRemarks) {
// We wanted size remarks. Check if there was a change to the number of