[LoopAccesses] Allow analysis to complete in the presence of uniform stores
authorAdam Nemet <anemet@apple.com>
Wed, 8 Apr 2015 17:48:40 +0000 (17:48 +0000)
committerAdam Nemet <anemet@apple.com>
Wed, 8 Apr 2015 17:48:40 +0000 (17:48 +0000)
commitce48250f1103e1f4bfaa24b23b1060fcaacf16ef
tree997956587b6e332780557480bac68d1d45067003
parentc2c9ea55255719cd4f03aa74d6ae8e4f3630c44e
[LoopAccesses] Allow analysis to complete in the presence of uniform stores

(Re-apply r234361 with a fix and a testcase for PR23157)

Both run-time pointer checking and the dependence analysis are capable
of dealing with uniform addresses. I.e. it's really just an orthogonal
property of the loop that the analysis computes.

Run-time pointer checking will only try to reason about SCEVAddRec
pointers or else gives up. If the uniform pointer turns out the be a
SCEVAddRec in an outer loop, the run-time checks generated will be
correct (start and end bounds would be equal).

In case of the dependence analysis, we work again with SCEVs. When
compared against a loop-dependent address of the same underlying object,
the difference of the two SCEVs won't be constant. This will result in
returning an Unknown dependence for the pair.

When compared against another uniform access, the difference would be
constant and we should return the right type of dependence
(forward/backward/etc).

The changes also adds support to query this property of the loop and
modify the vectorizer to use this.

Patch by Ashutosh Nema!

llvm-svn: 234424
llvm/include/llvm/Analysis/LoopAccessAnalysis.h
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Analysis/LoopAccessAnalysis/store-to-invariant-check1.ll [new file with mode: 0644]
llvm/test/Analysis/LoopAccessAnalysis/store-to-invariant-check2.ll [new file with mode: 0644]
llvm/test/Analysis/LoopAccessAnalysis/store-to-invariant-check3.ll [new file with mode: 0644]