[PATCH] MemoryDependenceAnalysis always depends on DominatorTree
Matt Arsenault
Matthew.Arsenault at amd.com
Fri Mar 29 22:18:19 PDT 2013
Added a test
Hi nlewycky,
http://llvm-reviews.chandlerc.com/D583
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D583?vs=1415&id=1450#toc
Files:
lib/Analysis/MemoryDependenceAnalysis.cpp
test/Analysis/MemoryDependenceAnalysis/lit.local.cfg
test/Analysis/MemoryDependenceAnalysis/memdep_requires_dominator_tree.ll
Index: lib/Analysis/MemoryDependenceAnalysis.cpp
===================================================================
--- lib/Analysis/MemoryDependenceAnalysis.cpp
+++ lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -56,6 +56,7 @@
// Register this pass...
INITIALIZE_PASS_BEGIN(MemoryDependenceAnalysis, "memdep",
"Memory Dependence Analysis", false, true)
+INITIALIZE_PASS_DEPENDENCY(DominatorTree)
INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
INITIALIZE_PASS_END(MemoryDependenceAnalysis, "memdep",
"Memory Dependence Analysis", false, true)
@@ -85,12 +86,13 @@
void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequiredTransitive<AliasAnalysis>();
+ AU.addRequired<DominatorTree>();
}
bool MemoryDependenceAnalysis::runOnFunction(Function &) {
AA = &getAnalysis<AliasAnalysis>();
TD = getAnalysisIfAvailable<DataLayout>();
- DT = getAnalysisIfAvailable<DominatorTree>();
+ DT = &getAnalysis<DominatorTree>();
if (PredCache == 0)
PredCache.reset(new PredIteratorCache());
return false;
Index: test/Analysis/MemoryDependenceAnalysis/lit.local.cfg
===================================================================
--- /dev/null
+++ test/Analysis/MemoryDependenceAnalysis/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.ll']
Index: test/Analysis/MemoryDependenceAnalysis/memdep_requires_dominator_tree.ll
===================================================================
--- /dev/null
+++ test/Analysis/MemoryDependenceAnalysis/memdep_requires_dominator_tree.ll
@@ -0,0 +1,19 @@
+; RUN: opt -memdep -gvn < %s
+
+define void @__memdep_requires_dominator_tree_kernel(i32* nocapture %bufUInt, i32* nocapture %pattern) nounwind {
+entry:
+ br label %for.body
+
+for.exit: ; preds = %for.body
+ ret void
+
+for.body: ; preds = %for.body, %entry
+ %i.01 = phi i32 [ 0, %entry ], [ %tmp8.7, %for.body ]
+ %arrayidx = getelementptr i32* %bufUInt, i32 %i.01
+ %arrayidx5 = getelementptr i32* %pattern, i32 %i.01
+ %tmp6 = load i32* %arrayidx5, align 4
+ store i32 %tmp6, i32* %arrayidx, align 4
+ %tmp8.7 = add i32 %i.01, 8
+ %cmp.7 = icmp ult i32 %tmp8.7, 1024
+ br i1 %cmp.7, label %for.body, label %for.exit
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D583.2.patch
Type: text/x-patch
Size: 2319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130329/dbabd629/attachment.bin>
More information about the llvm-commits
mailing list