[PATCH] [LAA] Merge memchecks for accesses separated by a constant offset
anemet at apple.com
Wed Jun 17 17:24:25 PDT 2015
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:214
@@ +213,3 @@
+ unsigned Value = I->getData();
+ if (Leader == Value) continue;
+ Value = SetLeaderIndex[Value];
> anemet wrote:
> > Can we already have Leader at this point in the EC?
> > I also think that Value and Leader are not really good names here. Perhaps "Set" and "Pointer"?
> > I read this far but I am not sure I understand this algorithm. It probably needs a big comment at the beginning explaining what's going on.
> > Also it looks quadratic. Could we do something better by perhaps analyzing the start values of the ARs and then only trying to match those that share the same base pointer? We may actually already have these "related" pointers in AccessAnalysis::DepCands. (The name is not great. This are candidates for dependence analysis, i.e. pointers that share the same underlying object.)
> We do have Leader (currently renamed) in the EC (the last one being added).
> I've renamed to FirstIndexInSet and Pointer in the latest revision.
> The algorithm is quadratic. However, the number of pointers is currently bounded (maximum 100 I believe). Also, the existing needsAnyChecking() etc are also quadratic, and we only run this when we would normally run something that is also quadratic, which made me think that it might not be that bad.
> I had a look at the DepCands, and it looks like they would need to be processed further as we want to partition into a sets of pointers which don't need checks within each set (and I don't think that's the case with DepCands). I think this would bring us back at a quadratic algorithm.
> One thing that we could do is iterate within DepCands for each pointer instead of iterating over the entire set of pointers. Matching only pointers with the same underlying object is also an option.
A DepCands equivalence class does not need *runtime* checks between its elements. (We analyze the accesses within such set with the MemoryDependenceChecker.)
I think that all we may need to do is to find the min start bound and the max end bound of a class within DepCands. This should cover the range for the entire class.
What do you think?
More information about the llvm-commits