[llvm] r359032 - [MemorySSA] LCSSA preserves MemorySSA.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 13:59:45 PDT 2019
Author: asbirlea
Date: Tue Apr 23 13:59:44 2019
New Revision: 359032
URL: http://llvm.org/viewvc/llvm-project?rev=359032&view=rev
Log:
[MemorySSA] LCSSA preserves MemorySSA.
Summary:
Enabling MemorySSA in the old pass manager leads to MemorySSA being run
twice due to the fact that LCSSA and LoopSimplify do not preserve
MemorySSA. This is the first step to address that: target LCSSA.
LCSSA does not make any changes that invalidate MemorySSA, so it
preserves it by design. It must preserve AA as well, for this to hold.
After this patch, MemorySSA is still run twice in the old pass manager.
Step two follows: target LoopSimplify.
Subscribers: mehdi_amini, jlebar, Prazek, llvm-commits, george.burgess.iv, chandlerc
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60832
Modified:
llvm/trunk/include/llvm/Analysis/LoopAnalysisManager.h
llvm/trunk/include/llvm/Analysis/MemorySSA.h
llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp
llvm/trunk/lib/Analysis/MemorySSA.cpp
llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopAnalysisManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopAnalysisManager.h?rev=359032&r1=359031&r2=359032&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopAnalysisManager.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopAnalysisManager.h Tue Apr 23 13:59:44 2019
@@ -61,9 +61,6 @@ struct LoopStandardAnalysisResults {
MemorySSA *MSSA;
};
-/// Enables memory ssa as a dependency for loop passes.
-extern cl::opt<bool> EnableMSSALoopDependency;
-
/// Extern template declaration for the analysis set for this IR unit.
extern template class AllAnalysesOn<Loop>;
Modified: llvm/trunk/include/llvm/Analysis/MemorySSA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemorySSA.h?rev=359032&r1=359031&r2=359032&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemorySSA.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemorySSA.h Tue Apr 23 13:59:44 2019
@@ -104,6 +104,9 @@
namespace llvm {
+/// Enables memory ssa as a dependency for loop passes.
+extern cl::opt<bool> EnableMSSALoopDependency;
+
class Function;
class Instruction;
class MemoryAccess;
Modified: llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp?rev=359032&r1=359031&r2=359032&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp Tue Apr 23 13:59:44 2019
@@ -18,11 +18,6 @@
using namespace llvm;
namespace llvm {
-/// Enables memory ssa as a dependency for loop passes in legacy pass manager.
-cl::opt<bool> EnableMSSALoopDependency(
- "enable-mssa-loop-dependency", cl::Hidden, cl::init(false),
- cl::desc("Enable MemorySSA dependency for loop pass manager"));
-
// Explicit template instantiations and specialization definitions for core
// template typedefs.
template class AllAnalysesOn<Loop>;
Modified: llvm/trunk/lib/Analysis/MemorySSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemorySSA.cpp?rev=359032&r1=359031&r2=359032&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemorySSA.cpp (original)
+++ llvm/trunk/lib/Analysis/MemorySSA.cpp Tue Apr 23 13:59:44 2019
@@ -81,6 +81,11 @@ bool llvm::VerifyMemorySSA = true;
#else
bool llvm::VerifyMemorySSA = false;
#endif
+/// Enables memory ssa as a dependency for loop passes in legacy pass manager.
+cl::opt<bool> llvm::EnableMSSALoopDependency(
+ "enable-mssa-loop-dependency", cl::Hidden, cl::init(false),
+ cl::desc("Enable MemorySSA dependency for loop pass manager"));
+
static cl::opt<bool, true>
VerifyMemorySSAX("verify-memoryssa", cl::location(VerifyMemorySSA),
cl::Hidden, cl::desc("Enable verification of MemorySSA."));
Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp?rev=359032&r1=359031&r2=359032&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Tue Apr 23 13:59:44 2019
@@ -34,9 +34,9 @@
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/LoopPass.h"
+#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
-#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
@@ -45,6 +45,7 @@
#include "llvm/IR/PredIteratorCache.h"
#include "llvm/Pass.h"
#include "llvm/Transforms/Utils.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"
using namespace llvm;
@@ -444,6 +445,7 @@ struct LCSSAWrapperPass : public Functio
AU.addPreserved<ScalarEvolutionWrapperPass>();
AU.addPreserved<SCEVAAWrapperPass>();
AU.addPreserved<BranchProbabilityInfoWrapperPass>();
+ AU.addPreserved<MemorySSAWrapperPass>();
// This is needed to perform LCSSA verification inside LPPassManager
AU.addRequired<LCSSAVerificationPass>();
@@ -490,5 +492,6 @@ PreservedAnalyses LCSSAPass::run(Functio
// BPI maps terminators to probabilities, since we don't modify the CFG, no
// updates are needed to preserve it.
PA.preserve<BranchProbabilityAnalysis>();
+ PA.preserve<MemorySSAAnalysis>();
return PA;
}
More information about the llvm-commits
mailing list