[llvm] [GVN] MemorySSA for GVN: add optional `AllowMemorySSA` (PR #120982)

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 11:47:14 PST 2025


================
@@ -832,7 +838,8 @@ PreservedAnalyses GVNPass::run(Function &F, FunctionAnalysisManager &AM) {
   auto *MemDep =
       isMemDepEnabled() ? &AM.getResult<MemoryDependenceAnalysis>(F) : nullptr;
   auto &LI = AM.getResult<LoopAnalysis>(F);
-  auto *MSSA = AM.getCachedResult<MemorySSAAnalysis>(F);
+  auto *MSSA =
+      isMemorySSAEnabled() ? &AM.getResult<MemorySSAAnalysis>(F) : nullptr;
----------------
alinas wrote:

Could you add an assert that MemDep and MSSA should never both be enabled?

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


More information about the llvm-commits mailing list