Skip to content

[NFC] Move DroppedVariableStats code to Analysis #120502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

rastogishubham
Copy link
Contributor

This is done because the CodeGen library and Passes library both link against Analysis, to avoid adding a dependency between CodeGen and Passes if we want to extend the DroppedVariableStats code for MIR stats as well, as seen in #120501

@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2024

@llvm/pr-subscribers-llvm-analysis

Author: Shubham Sandeep Rastogi (rastogishubham)

Changes

This is done because the CodeGen library and Passes library both link against Analysis, to avoid adding a dependency between CodeGen and Passes if we want to extend the DroppedVariableStats code for MIR stats as well, as seen in #120501


Full diff: https://github.com/llvm/llvm-project/pull/120502.diff

5 Files Affected:

  • (renamed) llvm/include/llvm/Analysis/DroppedVariableStats.h ()
  • (modified) llvm/include/llvm/Passes/StandardInstrumentations.h (+1-1)
  • (modified) llvm/lib/Analysis/CMakeLists.txt (+1)
  • (renamed) llvm/lib/Analysis/DroppedVariableStats.cpp (+1-1)
  • (modified) llvm/lib/Passes/CMakeLists.txt (-1)
diff --git a/llvm/include/llvm/Passes/DroppedVariableStats.h b/llvm/include/llvm/Analysis/DroppedVariableStats.h
similarity index 100%
rename from llvm/include/llvm/Passes/DroppedVariableStats.h
rename to llvm/include/llvm/Analysis/DroppedVariableStats.h
diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h
index 6ba466f9269f09..23bfee7115df6f 100644
--- a/llvm/include/llvm/Passes/StandardInstrumentations.h
+++ b/llvm/include/llvm/Passes/StandardInstrumentations.h
@@ -19,13 +19,13 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
+#include "llvm/Analysis/DroppedVariableStats.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/OptBisect.h"
 #include "llvm/IR/PassTimingInfo.h"
 #include "llvm/IR/ValueHandle.h"
-#include "llvm/Passes/DroppedVariableStats.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Transforms/IPO/SampleProfileProbe.h"
diff --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt
index 0db5b80f336cb5..5cf3777253fbe4 100644
--- a/llvm/lib/Analysis/CMakeLists.txt
+++ b/llvm/lib/Analysis/CMakeLists.txt
@@ -60,6 +60,7 @@ add_llvm_component_library(LLVMAnalysis
   DomPrinter.cpp
   DomTreeUpdater.cpp
   DominanceFrontier.cpp
+  DroppedVariableStats.cpp
   DXILResource.cpp
   DXILMetadataAnalysis.cpp
   FunctionPropertiesAnalysis.cpp
diff --git a/llvm/lib/Passes/DroppedVariableStats.cpp b/llvm/lib/Analysis/DroppedVariableStats.cpp
similarity index 99%
rename from llvm/lib/Passes/DroppedVariableStats.cpp
rename to llvm/lib/Analysis/DroppedVariableStats.cpp
index 5dc6b75fb8ace9..7162cece4f3d9b 100644
--- a/llvm/lib/Passes/DroppedVariableStats.cpp
+++ b/llvm/lib/Analysis/DroppedVariableStats.cpp
@@ -11,7 +11,7 @@
 ///
 ///===---------------------------------------------------------------------===//
 
-#include "llvm/Passes/DroppedVariableStats.h"
+#include "llvm/Analysis/DroppedVariableStats.h"
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/InstIterator.h"
 #include "llvm/IR/Module.h"
diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt
index 9e16a446c9b399..6425f4934b2103 100644
--- a/llvm/lib/Passes/CMakeLists.txt
+++ b/llvm/lib/Passes/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_llvm_component_library(LLVMPasses
   CodeGenPassBuilder.cpp
-  DroppedVariableStats.cpp
   OptimizationLevel.cpp
   PassBuilder.cpp
   PassBuilderBindings.cpp

@rastogishubham rastogishubham merged commit e389492 into llvm:main Dec 19, 2024
10 checks passed
@rastogishubham rastogishubham deleted the NFCIRStatsMove branch December 19, 2024 07:42
rastogishubham added a commit that referenced this pull request Dec 19, 2024
Reland "Add a pass to collect dropped var stats for MIR" (#117044)

I am trying to reland #115566

I also moved the DroppedVariableStats code to the Analysis lib

This is part of a stack of patches with
#120502 being the first one in
the stack
metaflow added a commit that referenced this pull request Dec 19, 2024
that introduces a circular dependency of analysis -> codegen -> target

This reverts commit e389492.
@metaflow
Copy link
Contributor

that creates a circular dependency of analysis on codegen

@rastogishubham
Copy link
Contributor Author

rastogishubham commented Dec 19, 2024

@metaflow Can you please tell me how I can reproduce the circular dependency? Analysis doesn't link against codegen, so I am confused as to how that happened

@metaflow
Copy link
Contributor

@rastogishubham I was looking on bazel build, let me try to reproduce this...

@metaflow
Copy link
Contributor

when e389492 landed DroppedVariableStats.h was

...
#include "llvm/CodeGen/MachinePassManager.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DiagnosticInfo.
...

and depended on codegen. In 0b5b09b you removed this dependency.

github-actions bot pushed a commit to arm/arm-toolchain that referenced this pull request Jan 10, 2025
Reland "Add a pass to collect dropped var stats for MIR" (#117044)

I am trying to reland llvm/llvm-project#115566

I also moved the DroppedVariableStats code to the Analysis lib

This is part of a stack of patches with
llvm/llvm-project#120502 being the first one in
the stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants