[llvm] r201866 - fail delinearization when the size of subscripts differs
Sebastian Pop
spop at codeaurora.org
Fri Feb 21 10:15:07 PST 2014
Author: spop
Date: Fri Feb 21 12:15:07 2014
New Revision: 201866
URL: http://llvm.org/viewvc/llvm-project?rev=201866&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/DependenceAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/DependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DependenceAnalysis.cpp?rev=201866&r1=201865&r2=201866&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/DependenceAnalysis.cpp Fri Feb 21 12:15:07 2014
@@ -3193,10 +3193,23 @@ DependenceAnalysis::tryDelinearize(const
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++)
More information about the llvm-commits
mailing list