diff options
author | Sebastian Pop <spop@codeaurora.org> | 2014-02-21 18:15:07 +0000 |
---|---|---|
committer | Sebastian Pop <spop@codeaurora.org> | 2014-02-21 18:15:07 +0000 |
commit | fc605ac12cd2035f6d096b53cbb2033e24bdc092 (patch) | |
tree | 1eb9ce8661f7ebfdb2b5c71601a361fa48626f24 /lib/Analysis/DependenceAnalysis.cpp | |
parent | 12681353c61e7079df93bb4205641d66ef5a5454 (diff) | |
download | llvm-fc605ac12cd2035f6d096b53cbb2033e24bdc092.tar.gz llvm-fc605ac12cd2035f6d096b53cbb2033e24bdc092.tar.bz2 llvm-fc605ac12cd2035f6d096b53cbb2033e24bdc092.tar.xz |
fail delinearization when the size of subscripts differs
Because the delinearization is not a global analysis pass, it will compute the
delinearization independently of knowledge about the way the delinearization
happened for other data accesses to the same array: the dependence analysis will
only trigger the delinearization on a tuple of access functions, and thus
delinearization may compute different subscripts sizes for a same array. When
that happens the safest is to discard the delinearized information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/DependenceAnalysis.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Analysis/DependenceAnalysis.cpp b/lib/Analysis/DependenceAnalysis.cpp index b74140db2c..6f9effa127 100644 --- a/lib/Analysis/DependenceAnalysis.cpp +++ b/lib/Analysis/DependenceAnalysis.cpp @@ -3193,10 +3193,23 @@ DependenceAnalysis::tryDelinearize(const SCEV *SrcSCEV, const SCEV *DstSCEV, DstAR->delinearize(*SE, DstSubscripts, DstSizes); int size = SrcSubscripts.size(); + // Fail when there is only a subscript: that's a linearized access function. + if (size < 2) + return false; + int dstSize = DstSubscripts.size(); - if (size != dstSize || size < 2) + // Fail when the number of subscripts in Src and Dst differ. + if (size != dstSize) return false; + // Fail when the size of any of the subscripts in Src and Dst differs: the + // dependence analysis assumes that elements in the same array have same size. + // SCEV delinearization does not have a context based on which it would decide + // globally the size of subscripts that would best fit all the array accesses. + for (int i = 0; i < size; ++i) + if (SrcSizes[i] != DstSizes[i]) + return false; + #ifndef NDEBUG DEBUG(errs() << "\nSrcSubscripts: "); for (int i = 0; i < size; i++) |