[llvm] Reapply "[GVN] MemorySSA for GVN: add optional AllowMemorySSA" (PR #122482)

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 09:02:18 PST 2025


================
@@ -3329,7 +3343,8 @@ class llvm::gvn::GVNLegacyPass : public FunctionPass {
     AU.addPreserved<TargetLibraryInfoWrapperPass>();
     AU.addPreserved<LoopInfoWrapperPass>();
     AU.addRequired<OptimizationRemarkEmitterWrapperPass>();
-    AU.addPreserved<MemorySSAWrapperPass>();
+    if (Impl.isMemorySSAEnabled())
+      AU.addRequired<MemorySSAWrapperPass>();
----------------
alinas wrote:

I meant that this line: `AU.addPreserved<MemorySSAWrapperPass>();` should be kept here, not removed.
But the diff to add the conditional required is good, could you readd please?
```
if (Impl.isMemorySSAEnabled())
      AU.addRequired<MemorySSAWrapperPass>();
```

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


More information about the llvm-commits mailing list