[PATCH] MemoryDependenceAnalysis always depends on DominatorTree
Evan Cheng
evan.cheng at apple.com
Sun Mar 31 10:52:16 PDT 2013
On Mar 29, 2013, at 3:54 PM, Daniel Berlin <dberlin at dberlin.org> wrote:
> On Fri, Mar 29, 2013 at 3:39 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>>
>> On Mar 27, 2013, at 5:44 PM, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:
>>
>>> 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.
>>
>> Adding the checks before DT is used is probably the better fix. Can you try that? Also, please include a test case.
>>
> If done, this seems like it would just cause the bug fixed in 166490
> to reoccur, unless that got fixed some other way. (This is the reason
> the DT checks were added)
It could be fixed by having the DT check return conservatively safe answer when DT is not available. Bill, please comment.
Evan
>
> The testcase that got added then was: test/Transforms/GVN/crash.ll
>
>> Evan
>>
>>>
>>> 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;
>>> <D583.1.patch>_______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list