[llvm] Reapply "[GVN] MemorySSA for GVN: add optional AllowMemorySSA" (PR #122482)
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 15:33:27 PST 2025
================
@@ -833,6 +839,8 @@ PreservedAnalyses GVNPass::run(Function &F, FunctionAnalysisManager &AM) {
isMemDepEnabled() ? &AM.getResult<MemoryDependenceAnalysis>(F) : nullptr;
auto &LI = AM.getResult<LoopAnalysis>(F);
auto *MSSA = AM.getCachedResult<MemorySSAAnalysis>(F);
+ if (isMemorySSAEnabled() && !MSSA)
+ MSSA = &AM.getResult<MemorySSAAnalysis>(F);
----------------
alinas wrote:
Can you add the assert inside this if clause (`assert (!MemDep && "...");`)?
If MSSA is already available, it's ok to use. But if it's unavailable and we pay the cost of computing from scratch, we should be able to drop the use MemDep. This shouldn't impact the compiler tracker, but it should make the pass crash if trying to turn on before implementing the switch.
https://github.com/llvm/llvm-project/pull/122482
More information about the llvm-commits
mailing list