[PATCH] D87137: [EarlyCSE] Explicitly require AAResultsWrapperPass.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 4 05:00:00 PDT 2020
fhahn created this revision.
fhahn added reviewers: asbirlea, george.burgess.iv, efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
fhahn requested review of this revision.
The MemorySSAWrapperPass depends on AAResultsWrapperPass and if
MemorySSA is preserved but AAResultsWrapperPass is not, this could lead
to a crash when updating the last user of the MemorySSAWrapperPass.
Alternatively AAResultsWrapperPass could be marked preserved by GVN, but
I am not sure if that would be safe. I am not sure what is required in
order to preserve AAResultsWrapperPass. At the moment, it seems like a
couple of passes that do similar transforms to GVN are preserving it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87137
Files:
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/EarlyCSE/reuse-preserved-memoryssa.ll
Index: llvm/test/Transforms/EarlyCSE/reuse-preserved-memoryssa.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/EarlyCSE/reuse-preserved-memoryssa.ll
@@ -0,0 +1,7 @@
+; RUN: opt -memoryssa -gvn -early-cse-memssa %s -S | FileCheck %s
+
+; CHECK: define void @foo(
+
+define void @foo() {
+ ret void
+}
Index: llvm/lib/Transforms/Scalar/GVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/GVN.cpp
+++ llvm/lib/Transforms/Scalar/GVN.cpp
@@ -2850,7 +2850,6 @@
if (Impl.isMemDepEnabled())
AU.addRequired<MemoryDependenceWrapperPass>();
AU.addRequired<AAResultsWrapperPass>();
-
AU.addPreserved<DominatorTreeWrapperPass>();
AU.addPreserved<GlobalsAAWrapperPass>();
AU.addPreserved<TargetLibraryInfoWrapperPass>();
Index: llvm/lib/Transforms/Scalar/EarlyCSE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -1463,6 +1463,7 @@
AU.addRequired<TargetLibraryInfoWrapperPass>();
AU.addRequired<TargetTransformInfoWrapperPass>();
if (UseMemorySSA) {
+ AU.addRequired<AAResultsWrapperPass>();
AU.addRequired<MemorySSAWrapperPass>();
AU.addPreserved<MemorySSAWrapperPass>();
}
@@ -1504,6 +1505,7 @@
"Early CSE w/ MemorySSA", false, false)
INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
+INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87137.289917.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200904/0e64fcf6/attachment.bin>
More information about the llvm-commits
mailing list