[polly] r209695 - pass element size to delinearization
Sebastian Pop
spop at codeaurora.org
Tue May 27 15:42:09 PDT 2014
Author: spop
Date: Tue May 27 17:42:09 2014
New Revision: 209695
URL: http://llvm.org/viewvc/llvm-project?rev=209695&view=rev
Log:
pass element size to delinearization
Instead of relying on the delinearization to infer the size of an element,
compute the element size from the base address type. This is a much more precise
way of computing the element size than before, as we would have mixed together
the size of an element with the strides of the innermost dimension.
Modified:
polly/trunk/include/polly/ScopDetection.h
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/TempScopInfo.cpp
Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=209695&r1=209694&r2=209695&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Tue May 27 17:42:09 2014
@@ -77,6 +77,7 @@ typedef std::set<const SCEV *> ParamSetT
typedef std::vector<const SCEVAddRecExpr *> AFs;
typedef std::map<const SCEVUnknown *, AFs> BaseToAFs;
+typedef std::map<const SCEVUnknown *, const SCEV *> BaseToElSize;
extern bool PollyTrackFailures;
extern bool PollyDelinearize;
@@ -106,6 +107,7 @@ class ScopDetection : public FunctionPas
// Map a base pointer to all access functions accessing it.
BaseToAFs NonAffineAccesses, AffineAccesses;
+ BaseToElSize ElementSize;
DetectionContext(Region &R, AliasAnalysis &AA, bool Verify)
: CurRegion(R), AST(AA), Verifying(Verify), Log(&R) {}
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=209695&r1=209694&r2=209695&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Tue May 27 17:42:09 2014
@@ -363,7 +363,7 @@ bool ScopDetection::hasAffineMemoryAcces
// Second step: find array shape.
SmallVector<const SCEV *, 4> Sizes;
- SE->findArrayDimensions(Terms, Sizes);
+ SE->findArrayDimensions(Terms, Sizes, Context.ElementSize[BasePointer]);
// Third step: compute the access functions for each subscript.
for (const SCEVAddRecExpr *AF : Context.NonAffineAccesses[BasePointer]) {
@@ -422,6 +422,9 @@ bool ScopDetection::isValidMemoryAccess(
return invalid<ReportNonAffineAccess>(Context, /*Assert=*/true,
AccessFunction);
+ const SCEV *ElementSize = SE->getElementSize(&Inst);
+ Context.ElementSize[BasePointer] = ElementSize;
+
// Collect all non affine memory accesses, and check whether they are linear
// at the end of scop detection. That way we can delinearize all the memory
// accesses to the same array in a unique step.
Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=209695&r1=209694&r2=209695&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Tue May 27 17:42:09 2014
@@ -171,7 +171,9 @@ IRAccess TempScopInfo::buildIRAccess(Ins
const SCEVAddRecExpr *AF = dyn_cast<SCEVAddRecExpr>(AccessFunction);
if (!IsAffine && PollyDelinearize && AF) {
- const SCEV *Remainder = AF->delinearize(*SE, Subscripts, Sizes);
+ const SCEV *ElementSize = SE->getElementSize(Inst);
+ const SCEV *Remainder =
+ AF->delinearize(*SE, Subscripts, Sizes, ElementSize);
int NSubs = Subscripts.size();
if (NSubs > 0) {
More information about the llvm-commits
mailing list