[PATCH] D15124: Use @llvm.invariant.start/end intrinsics to extend the meaning of basic AA's pointsToConstantMemory(), for GVN-based load elimination purposes [Local objects only]
Larisse Voufo via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 10 11:27:05 PST 2015
lvoufo added a comment.
In http://reviews.llvm.org/D15124#307279, @dberlin wrote:
> "(2) -gvn already requires -basicaa. So, -basicaa would be redundant in
> '-basicaa -gvn'. I could add it for clarity if you prefer.
> "
> -gvn does not require -basicaa.
> You've stated this a few times, and i'm not sure why you think this.
>
> <from GVN>:
>
> void getAnalysisUsage(AnalysisUsage &AU) const override {
> AU.addRequired<AssumptionCacheTracker>();
> AU.addRequired<DominatorTreeWrapperPass>();
> AU.addRequired<TargetLibraryInfoWrapperPass>();
> if (!NoLoads)
> AU.addRequired<MemoryDependenceAnalysis>();
> AU.addRequired<AAResultsWrapperPass>();
>
>
> }
>
> GVN requires AC, DominatorTree, and TLI all the time.
> It uses AA results, which is "whatever aa you have enabled".
> It requires memorydependence if you want to optimize loads.
> Memory dependence, in turn, does not require basicaa either:
>
> void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
>
> AU.setPreservesAll();
> AU.addRequired<AssumptionCacheTracker>();
> AU.addRequiredTransitive<AAResultsWrapperPass>();
> AU.addRequiredTransitive<TargetLibraryInfoWrapperPass>();
> }
>
>
>
> No passes *require* basicaa, because basicaa is an optional pass providing
> AA results.
Point taken. I may be misusing "require" here, but I sure understand what is going on better now thanks to this.
To clarify my statements and for added clarity from your points above, I have 2 questions:
1 - What is one to make of the dependence on `BasicAAWrapperPass` in the following?
INITIALIZE_PASS_BEGIN(AAResultsWrapperPass, "aa",
"Function Alias Analysis Results", false, true)
INITIALIZE_PASS_DEPENDENCY(BasicAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(CFLAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(ExternalAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(ObjCARCAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(SCEVAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(ScopedNoAliasAAWrapperPass)
INITIALIZE_PASS_DEPENDENCY(TypeBasedAAWrapperPass)
INITIALIZE_PASS_END(AAResultsWrapperPass, "aa",
"Function Alias Analysis Results", false, true)
So far as I understand, this *will* initialize a `BaiscAAWrapperPass` pass which, when run (either via `run()` or `runOnFunction()`), will build a `BasicAAResult` object.
2 - There does not seem to be a difference between `opt -gvn` and `opt -basicaa -gvn`. In fact, running `opt -gvn -debug-pass=Arguments` and `opt -basicaa -gvn -debug-pass=Arguments` both return the following, where -basicaa is automatically added.
Pass Arguments: -targetlibinfo -tti -assumption-cache-tracker -invariant-info-marker -basicaa -domtree -aa -memdep -gvn -verify
http://reviews.llvm.org/D15124
More information about the llvm-commits
mailing list