[llvm] [DirectX] Add GlobalDCE pass after finalize linkage pass in DirectX backend (PR #151071)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 14:18:07 PDT 2025


================
@@ -30,6 +32,36 @@ using namespace llvm;
 
 #define DEBUG_TYPE "globaldce"
 
+namespace {
+class GlobalDCELegacyPass : public ModulePass {
+public:
+  static char ID; // Pass identification, replacement for typeid
+  GlobalDCELegacyPass() : ModulePass(ID) {
+    initializeGlobalDCELegacyPassPass(*PassRegistry::getPassRegistry());
+  }
+  bool runOnModule(Module &M) override {
+    if (skipModule(M))
+      return false;
+    // Note: GlobalDCEPass does not use MAM. That
+    // means we can get away with init and pass
+    // as arg.
----------------
bogner wrote:

This comment is a little hard to follow. Maybe "Note: GlobalDCEPass does not use any analyses, so we're safe to call the new-pm style pass with a default-initialized analysis manager here"?

https://github.com/llvm/llvm-project/pull/151071


More information about the llvm-commits mailing list