[llvm-commits] [polly] r148810 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp lib/CodeGeneration.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Tue Jan 24 08:42:17 PST 2012
Author: grosser
Date: Tue Jan 24 10:42:16 2012
New Revision: 148810
URL: http://llvm.org/viewvc/llvm-project?rev=148810&view=rev
Log:
ScopInfo: Add isStrideX to unify stride checking
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGeneration.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=148810&r1=148809&r2=148810&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue Jan 24 10:42:16 2012
@@ -140,15 +140,18 @@
/// @brief Get the stride of this memory access in the specified domain
/// subset.
- isl_set *getStride(const isl_set *domainSubset) const;
+ isl_set *getStride(__isl_take const isl_set *domainSubset) const;
+
+ /// @brief Is the stride of the access equal to a certain width.
+ bool isStrideX(__isl_take const isl_set *DomainSubset, int StrideWidth) const;
/// @brief Is consecutive memory accessed for a given
/// statement instance set?
- bool isStrideOne(const isl_set *domainSubset) const;
+ bool isStrideOne(__isl_take const isl_set *domainSubset) const;
/// @brief Is always the same memory accessed for a given
/// statement instance set?
- bool isStrideZero(const isl_set *domainSubset) const;
+ bool isStrideZero(__isl_take const isl_set *domainSubset) const;
/// @brief Get the statement that contains this memory access.
ScopStmt *getStatement() const { return statement; }
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=148810&r1=148809&r2=148810&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Jan 24 10:42:16 2012
@@ -429,9 +429,9 @@
return isl_map_from_basic_map(bmap);
}
-isl_set *MemoryAccess::getStride(const isl_set *domainSubset) const {
+isl_set *MemoryAccess::getStride(__isl_take const isl_set *domainSubset) const {
isl_map *accessRelation = getAccessRelation();
- isl_set *scatteringDomain = isl_set_copy(const_cast<isl_set*>(domainSubset));
+ isl_set *scatteringDomain = const_cast<isl_set*>(domainSubset);
isl_map *scattering = getStatement()->getScattering();
scattering = isl_map_reverse(scattering);
@@ -458,34 +458,28 @@
return isl_map_deltas(nextScatt);
}
-bool MemoryAccess::isStrideZero(const isl_set *DomainSubset) const {
- isl_set *Stride, *StrideZero;
- bool IsStrideZero;
+bool MemoryAccess::isStrideX(__isl_take const isl_set *DomainSubset,
+ int StrideWidth) const {
+ isl_set *Stride, *StrideX;
+ bool IsStrideX;
Stride = getStride(DomainSubset);
- StrideZero = isl_set_universe(isl_set_get_space(Stride));
- StrideZero = isl_set_fix_si(StrideZero, isl_dim_set, 0, 0);
- IsStrideZero = isl_set_is_equal(Stride, StrideZero);
+ StrideX = isl_set_universe(isl_set_get_space(Stride));
+ StrideX = isl_set_fix_si(StrideX, isl_dim_set, 0, StrideWidth);
+ IsStrideX = isl_set_is_equal(Stride, StrideX);
- isl_set_free(StrideZero);
+ isl_set_free(StrideX);
isl_set_free(Stride);
- return IsStrideZero;
+ return IsStrideX;
}
-bool MemoryAccess::isStrideOne(const isl_set *DomainSubset) const {
- isl_set *Stride, *StrideOne;
- bool IsStrideOne;
-
- Stride = getStride(DomainSubset);
- StrideOne = isl_set_universe(isl_set_get_space(Stride));
- StrideOne = isl_set_fix_si(StrideOne, isl_dim_set, 0, 1);
- IsStrideOne = isl_set_is_equal(Stride, StrideOne);
-
- isl_set_free(StrideOne);
- isl_set_free(Stride);
+bool MemoryAccess::isStrideZero(const isl_set *DomainSubset) const {
+ return isStrideX(DomainSubset, 0);
+}
- return IsStrideOne;
+bool MemoryAccess::isStrideOne(const isl_set *DomainSubset) const {
+ return isStrideX(DomainSubset, 1);
}
void MemoryAccess::setNewAccessRelation(isl_map *newAccess) {
Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=148810&r1=148809&r2=148810&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Tue Jan 24 10:42:16 2012
@@ -456,9 +456,9 @@
assert(scatteringDomain && "No scattering domain available");
- if (Access.isStrideZero(scatteringDomain))
+ if (Access.isStrideZero(isl_set_copy(scatteringDomain)))
newLoad = generateStrideZeroLoad(load, scalarMaps[0], vectorWidth);
- else if (Access.isStrideOne(scatteringDomain))
+ else if (Access.isStrideOne(isl_set_copy(scatteringDomain)))
newLoad = generateStrideOneLoad(load, scalarMaps[0], vectorWidth);
else
newLoad = generateUnknownStrideLoad(load, scalarMaps, vectorWidth);
@@ -515,7 +515,7 @@
const Value *pointer = store->getPointerOperand();
Value *vector = getOperand(store->getValueOperand(), BBMap, &vectorMap);
- if (Access.isStrideOne(scatteringDomain)) {
+ if (Access.isStrideOne(isl_set_copy(scatteringDomain))) {
Type *vectorPtrType = getVectorPtrTy(pointer, vectorWidth);
Value *newPointer = getOperand(pointer, BBMap, &vectorMap);
@@ -1259,7 +1259,8 @@
for (int i = 1; i < vectorWidth; i++)
IVS[i] = Builder.CreateAdd(IVS[i-1], StrideValue, "p_vector_iv");
- isl_set *scatteringDomain = isl_set_from_cloog_domain(f->domain);
+ isl_set *scatteringDomain =
+ isl_set_copy(isl_set_from_cloog_domain(f->domain));
// Add loop iv to symbols.
(*clastVars)[f->iterator] = LB;
@@ -1273,6 +1274,7 @@
}
// Loop is finished, so remove its iv from the live symbols.
+ isl_set_free(scatteringDomain);
clastVars->erase(f->iterator);
}
More information about the llvm-commits
mailing list