[llvm] [GVN] MemorySSA for GVN: eliminate redundant loads via MemorySSA (PR #152859)
    Antonio Frighetto via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Oct 20 12:33:56 PDT 2025
    
    
  
================
@@ -887,7 +892,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.getCachedResult<MemorySSAAnalysis>(F) : nullptr;
----------------
antoniofrighetto wrote:
Should avoid retrieving cached results (and thus computing MemorySSAUpdater) if MemorySSA is not enabled (missed from the initial patch, realized while running tests, may happen that both MD and MSSAU exist, as of now).
https://github.com/llvm/llvm-project/pull/152859
    
    
More information about the llvm-commits
mailing list