[polly] r256209 - ScopInfo: Small improvement to schedule construction [NFC]

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 15:01:53 PST 2015


Author: grosser
Date: Mon Dec 21 17:01:53 2015
New Revision: 256209

URL: http://llvm.org/viewvc/llvm-project?rev=256209&view=rev
Log:
ScopInfo: Small improvement to schedule construction [NFC]

We clarify that certain code is only executed if LSchedule is != nullptr.
Previously some of these functions have been executed, but they only passed
a nullptr through. This caused some confusion when reading the code.

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=256209&r1=256208&r2=256209&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Dec 21 17:01:53 2015
@@ -3396,10 +3396,7 @@ static isl_stat mapToDimension_AddSet(__
 static __isl_give isl_multi_union_pw_aff *
 mapToDimension(__isl_take isl_union_set *USet, int N) {
   assert(N >= 0);
-
-  if (!USet)
-    return nullptr;
-
+  assert(USet);
   assert(!isl_union_set_is_empty(USet));
 
   struct MapToDimensionDataTy Data;
@@ -3477,10 +3474,6 @@ void Scop::buildSchedule(
     isl_schedule *LSchedule = LSchedulePair.first;
     unsigned NumVisited = LSchedulePair.second;
     while (L && NumVisited == L->getNumBlocks()) {
-      auto *LDomain = isl_schedule_get_domain(LSchedule);
-      if (auto *MUPA = mapToDimension(LDomain, LD + 1))
-        LSchedule = isl_schedule_insert_partial_schedule(LSchedule, MUPA);
-
       auto *PL = L->getParentLoop();
 
       // Either we have a proper loop and we also build a schedule for the
@@ -3493,7 +3486,14 @@ void Scop::buildSchedule(
         break;
 
       auto &PSchedulePair = LoopSchedules[PL];
-      PSchedulePair.first = combineInSequence(PSchedulePair.first, LSchedule);
+
+      if (LSchedule) {
+        auto *LDomain = isl_schedule_get_domain(LSchedule);
+        auto *MUPA = mapToDimension(LDomain, LD + 1);
+        LSchedule = isl_schedule_insert_partial_schedule(LSchedule, MUPA);
+        PSchedulePair.first = combineInSequence(PSchedulePair.first, LSchedule);
+      }
+
       PSchedulePair.second += NumVisited;
 
       L = PL;




More information about the llvm-commits mailing list