[polly] r249680 - [FIX] Add missing projection for invariant load domains

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 04:05:57 PDT 2015


Author: jdoerfert
Date: Thu Oct  8 06:05:57 2015
New Revision: 249680

URL: http://llvm.org/viewvc/llvm-project?rev=249680&view=rev
Log:
[FIX] Add missing projection for invariant load domains

  This was left out from the original patch proposed in
    http://reviews.llvm.org/D13195
  even though it is needed to define an order invariant loads
  are hoisted.


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

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=249680&r1=249679&r2=249680&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Oct  8 06:05:57 2015
@@ -1389,6 +1389,26 @@ void ScopStmt::hoistMemoryAccesses(Memor
   DomainCtx = isl_set_detect_equalities(DomainCtx);
   DomainCtx = isl_set_coalesce(DomainCtx);
 
+  Scop &S = *getParent();
+  ScalarEvolution &SE = *S.getSE();
+
+  // Project out all parameters that relate to loads in this statement that
+  // we will hoist. Otherwise we would have cyclic dependences on the
+  // constraints under which the hoisted loads are executed and we could not
+  // determine an order in which to preload them. This happens because not only
+  // lower bounds are part of the domain but also upper bounds.
+  for (MemoryAccess *MA : InvMAs) {
+    Instruction *AccInst = MA->getAccessInstruction();
+    if (SE.isSCEVable(AccInst->getType())) {
+      isl_id *ParamId = S.getIdForParam(SE.getSCEV(AccInst));
+      if (ParamId) {
+        int Dim = isl_set_find_dim_by_id(DomainCtx, isl_dim_param, ParamId);
+        DomainCtx = isl_set_eliminate(DomainCtx, isl_dim_param, Dim, 1);
+      }
+      isl_id_free(ParamId);
+    }
+  }
+
   for (MemoryAccess *MA : InvMAs)
     TargetList.push_back(std::make_pair(MA, isl_set_copy(DomainCtx)));
 




More information about the llvm-commits mailing list