[PATCH] MemoryDependenceAnalysis always depends on DominatorTree
Matt Arsenault
Matthew.Arsenault at amd.com
Wed Mar 27 17:44:06 PDT 2013
Hi nlewycky,
The DominatorTree was optional, but the uses of the tree aren't checked, causing it to crash when not available.
I've made DominatorTree required, although I'm not sure if it would be better to put the checks before its uses instead.
http://llvm-reviews.chandlerc.com/D583
Files:
lib/Analysis/MemoryDependenceAnalysis.cpp
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D583.1.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/c63f6b16/attachment.bin>
More information about the llvm-commits
mailing list