[PATCH] D23916: [Polly] Check validity of new access relations. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 12:25:23 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL280404: Check validity of new access relations. NFC. (authored by Meinersbur).

Changed prior to commit:
  https://reviews.llvm.org/D23916?vs=70048&id=70049#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23916

Files:
  polly/trunk/lib/Analysis/ScopInfo.cpp

Index: polly/trunk/lib/Analysis/ScopInfo.cpp
===================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp
+++ polly/trunk/lib/Analysis/ScopInfo.cpp
@@ -963,6 +963,44 @@
 }
 
 void MemoryAccess::setNewAccessRelation(__isl_take isl_map *NewAccess) {
+  assert(NewAccess);
+
+#ifndef NDEBUG
+  // Check domain space compatibility.
+  auto *NewSpace = isl_map_get_space(NewAccess);
+  auto *NewDomainSpace = isl_space_domain(isl_space_copy(NewSpace));
+  auto *OriginalDomainSpace = getStatement()->getDomainSpace();
+  assert(isl_space_has_equal_tuples(OriginalDomainSpace, NewDomainSpace));
+  isl_space_free(NewDomainSpace);
+  isl_space_free(OriginalDomainSpace);
+
+  // Check whether there is an access for every statement instance.
+  auto *StmtDomain = getStatement()->getDomain();
+  StmtDomain = isl_set_intersect_params(
+      StmtDomain, getStatement()->getParent()->getContext());
+  auto *NewDomain = isl_map_domain(isl_map_copy(NewAccess));
+  assert(isl_set_is_subset(StmtDomain, NewDomain) &&
+         "Partial accesses not supported");
+  isl_set_free(NewDomain);
+  isl_set_free(StmtDomain);
+
+  // Check whether access dimensions correspond to number of dimensions of the
+  // accesses array.
+  auto *NewAccessSpace = isl_space_range(NewSpace);
+  assert(isl_space_has_tuple_id(NewAccessSpace, isl_dim_set) &&
+         "Must specify the array that is accessed");
+  auto *NewArrayId = isl_space_get_tuple_id(NewAccessSpace, isl_dim_set);
+  auto *SAI = static_cast<ScopArrayInfo *>(isl_id_get_user(NewArrayId));
+  assert(SAI && "Must set a ScopArrayInfo");
+  assert(!SAI->getBasePtrOriginSAI() &&
+         "Indirect array not supported by codegen");
+  auto Dims = SAI->getNumberOfDimensions();
+  assert(isl_space_dim(NewAccessSpace, isl_dim_set) == Dims &&
+         "Access dims must match array dims");
+  isl_space_free(NewAccessSpace);
+  isl_id_free(NewArrayId);
+#endif
+
   isl_map_free(NewAccessRelation);
   NewAccessRelation = NewAccess;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23916.70049.patch
Type: text/x-patch
Size: 2027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160901/259892c9/attachment.bin>


More information about the llvm-commits mailing list