[EarlyCSE] Add option to use MemorySSA for function simplification run of EarlyCSE (off by default).
Summary:
Use MemorySSA for memory dependency checking in the EarlyCSE pass at the
start of the function simplification portion of the pipeline. We rely
on the fact that GVNHoist runs just after this pass of EarlyCSE to
amortize the MemorySSA construction cost since GVNHoist uses MemorySSA
and EarlyCSE preserves it.
This is turned off by default. A follow-up change will turn it on to
allow for easier reversion in case it breaks something.
llvm-svn: 305146
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 1f638e7..afd66f5 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -160,6 +160,10 @@
cl::Hidden, cl::ZeroOrMore,
cl::desc("Run NewGVN instead of GVN"));
+static cl::opt<bool> EnableEarlyCSEMemSSA(
+ "enable-npm-earlycse-memssa", cl::init(false), cl::Hidden,
+ cl::desc("Enable the EarlyCSE w/ MemorySSA pass for the new PM (default = off)"));
+
static cl::opt<bool> EnableGVNHoist(
"enable-npm-gvn-hoist", cl::init(false), cl::Hidden,
cl::desc("Enable the GVN hoisting pass for the new PM (default = off)"));
@@ -312,7 +316,7 @@
FPM.addPass(SROA());
// Catch trivial redundancies
- FPM.addPass(EarlyCSEPass());
+ FPM.addPass(EarlyCSEPass(EnableEarlyCSEMemSSA));
// Hoisting of scalars and load expressions.
if (EnableGVNHoist)