LoopAccessAnalysis performs dependence analysis for our loop vectorization and other loop transformation passes. Its builtin dependence analysis is fairly simple, and ends up missing a number of common cases. As a result, we end up inserting runtime checks where they're not really needed (or perhaps not vectorizing at all).
LLVM has a more-sophisticated DependenceAnalysis implementation which does catch more of these cases. This patch adds a mode, disabled by default, under which we can use DependenceAnalysis from LoopAccessAnalysis. I've included an example test case in which the use of DependenceAnalysis allows us to elide unnecessary runtime checks.
We should discuss whether we should have, as a general refactoring goal, having LoopAccessAnalysis use DependenceAnalysis for all of its dependence-analysis needs. And if not, why not.
DA is independent of the loop versioning. Therefore if we have NoDep here then the versioning performed by replaceSymbolicStrideSCEV/isStridedPtr wouldn't help. So by moving this above the replaceSymbolicStrideSCEV calls, we could reduce the number of run-time checks needed.