Skip to content

[DirectX] Remove new-pm versions of DXILResource passes. NFC #100698

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

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Jul 26, 2024

This is a bit of a hack, but these aren't actually used at the moment
and they'll cause naming conflicts with DXIL resource passes that I'm
adding to llvm/Analysis for replacing all of this with the target
extension type based solution. I'd rather leave the existing stuff in
place until we're ready to replace it completely, and this is the
simplest way to get away with that.

Created using spr 1.3.5-bogner
@llvmbot
Copy link
Member

llvmbot commented Jul 26, 2024

@llvm/pr-subscribers-backend-directx

Author: Justin Bogner (bogner)

Changes

This is a bit of a hack, but these aren't actually used at the moment
and they'll cause naming conflicts with DXIL resource passes that I'm
adding to llvm/Analysis for replacing all of this with the target
extension type based solution. I'd rather leave the existing stuff in
place until we're ready to replace it completely, and this is the
simplest way to get away with that.


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

3 Files Affected:

  • (modified) llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp (-16)
  • (modified) llvm/lib/Target/DirectX/DXILResourceAnalysis.h (-20)
  • (modified) llvm/lib/Target/DirectX/DirectXPassRegistry.def (-2)
diff --git a/llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp b/llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp
index 0b2f0d827ebbc..35d750311ffd4 100644
--- a/llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp
+++ b/llvm/lib/Target/DirectX/DXILResourceAnalysis.cpp
@@ -18,22 +18,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "dxil-resource-analysis"
 
-dxil::Resources DXILResourceAnalysis::run(Module &M,
-                                          ModuleAnalysisManager &AM) {
-  dxil::Resources R;
-  R.collect(M);
-  return R;
-}
-
-AnalysisKey DXILResourceAnalysis::Key;
-
-PreservedAnalyses DXILResourcePrinterPass::run(Module &M,
-                                               ModuleAnalysisManager &AM) {
-  dxil::Resources Res = AM.getResult<DXILResourceAnalysis>(M);
-  Res.print(OS);
-  return PreservedAnalyses::all();
-}
-
 char DXILResourceWrapper::ID = 0;
 INITIALIZE_PASS_BEGIN(DXILResourceWrapper, DEBUG_TYPE,
                       "DXIL resource Information", true, true)
diff --git a/llvm/lib/Target/DirectX/DXILResourceAnalysis.h b/llvm/lib/Target/DirectX/DXILResourceAnalysis.h
index bce41160b95ec..aa66180b560be 100644
--- a/llvm/lib/Target/DirectX/DXILResourceAnalysis.h
+++ b/llvm/lib/Target/DirectX/DXILResourceAnalysis.h
@@ -19,26 +19,6 @@
 #include <memory>
 
 namespace llvm {
-/// Analysis pass that exposes the \c DXILResource for a module.
-class DXILResourceAnalysis : public AnalysisInfoMixin<DXILResourceAnalysis> {
-  friend AnalysisInfoMixin<DXILResourceAnalysis>;
-  static AnalysisKey Key;
-
-public:
-  typedef dxil::Resources Result;
-  dxil::Resources run(Module &M, ModuleAnalysisManager &AM);
-};
-
-/// Printer pass for the \c DXILResourceAnalysis results.
-class DXILResourcePrinterPass : public PassInfoMixin<DXILResourcePrinterPass> {
-  raw_ostream &OS;
-
-public:
-  explicit DXILResourcePrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
-  static bool isRequired() { return true; }
-};
-
 /// The legacy pass manager's analysis pass to compute DXIL resource
 /// information.
 class DXILResourceWrapper : public ModulePass {
diff --git a/llvm/lib/Target/DirectX/DirectXPassRegistry.def b/llvm/lib/Target/DirectX/DirectXPassRegistry.def
index 1b326d020d511..754f174b96052 100644
--- a/llvm/lib/Target/DirectX/DirectXPassRegistry.def
+++ b/llvm/lib/Target/DirectX/DirectXPassRegistry.def
@@ -17,7 +17,6 @@
 #define MODULE_ANALYSIS(NAME, CREATE_PASS)
 #endif
 MODULE_ANALYSIS("dx-shader-flags", dxil::ShaderFlagsAnalysis())
-MODULE_ANALYSIS("dxil-resource", DXILResourceAnalysis())
 #undef MODULE_ANALYSIS
 
 #ifndef MODULE_PASS
@@ -25,5 +24,4 @@ MODULE_ANALYSIS("dxil-resource", DXILResourceAnalysis())
 #endif
 // TODO: rename to print<foo> after NPM switch
 MODULE_PASS("print-dx-shader-flags", dxil::ShaderFlagsAnalysisPrinter(dbgs()))
-MODULE_PASS("print-dxil-resource", DXILResourcePrinterPass(dbgs()))
 #undef MODULE_PASS

bogner added a commit to bogner/llvm-project that referenced this pull request Jul 30, 2024
This is a bit of a hack, but these aren't actually used at the moment
and they'll cause naming conflicts with DXIL resource passes that I'm
adding to llvm/Analysis for replacing all of this with the target
extension type based solution. I'd rather leave the existing stuff in
place until we're ready to replace it completely, and this is the
simplest way to get away with that.

Pull Request: llvm#100698
@bogner
Copy link
Contributor Author

bogner commented Jul 31, 2024

Turns out I was wrong and this does not effectively avoid the naming collisions. Tried again here: #101393

@bogner bogner closed this Jul 31, 2024
bogner added a commit that referenced this pull request Aug 1, 2024
…eMD*. NFC

These passes will be replaced soon as we move to the target extension based
resource handling in the DirectX backend, but removing them now before the
replacement stuff is all up and running would be very disruptive. However, we
do need to move these passes out of the way to avoid symbol conflicts with the
new DXILResourceAnalysis in the Analysis library.

Note: I tried an even simpler hack in #100698 but it doesn't really work. A
rename is the most expedient path forward here.

Pull Request: #101393
@bogner bogner deleted the users/bogner/sprdirectx-remove-new-pm-versions-of-dxilresource-passes-nfc branch November 20, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants