[PATCH] D25557: [LAA] Collect pointers with unknown bounds
Evgeny Astigeevich via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 18 09:19:58 PDT 2016
eastig added inline comments.
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:718
- bool CanDoRTIfNeeded = !NeedRTCheck || CanDoRT;
- if (!CanDoRTIfNeeded)
- return CanDoRTIfNeeded;
+ return !NeedRTCheck || CanDoRT;
> eastig wrote:
> > ashutosh.nema wrote:
> > > Earlier when “NeedRTCheck” is true & LAA can’t find the bounds of pointer it used to reset the “Need” field of RuntimePointerChecking, but with this change it can remains set. Is this expected change ?
> > The old behaviour is to reset RtCheck if we can not do RT checks when they are needed. Resetting means to make RtCheck Pointers and Checks empty. When they are empty it doesn't matter what a value Need has. We can do nothing with such RtCheck. But when Pointers is not empty the value of Need is important. According its documentation Need indicates if we need to add the runtime check. So when it's true RT checks might be created. They are not created if there are pointers with unknown bounds. In such case it's a user responsibility to create checks. The user can analyze Pointers and PtrsWithUnknownBounds and create needed checks.
> > I hope this explains why Need must be preserved.
> I’m worried about cases where decisions are made based on “Need” flag, for example vectorizer. Earlier when this flag is true, vectorizer expects complete runtime check from LAA but with this change it may not be the same case, rather it will be expected from vectorizer to generate the complete check.
I've looked how "Need" is used. It is used according to its meaning: RT checks need to be added. The vectorizer uses LAI->canVectorizeMemory() to check if a loop can be vectorized. canVectorizeMemory() returns the value of CanVecMem which is set to false if CanDoRTIfNeeded is false (Need is true but CanDoRT is false). So in places where the vectorizer expects complete runtime checks they are complete because CanVecMem guarantees this.
I can update documentation of "Need" to mention that when it is true it does not mean it can do RT check. This is what it's written in comments to AccessAnalysis::canCheckPtrAtRT. Also when "Need" is calculated both pointers with known bounds and pointers with unknown bounds are taken into account.
More information about the llvm-commits