[polly] r308220 - [Polly] Avoid use of `getStmtFor(BB)` in PolyhedralInfo. NFC

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 13:58:13 PDT 2017


Author: grosser
Date: Mon Jul 17 13:58:13 2017
New Revision: 308220

URL: http://llvm.org/viewvc/llvm-project?rev=308220&view=rev
Log:
[Polly] Avoid use of `getStmtFor(BB)` in PolyhedralInfo. NFC

Summary: Since there will be no more a 1-1 correspondence between statements and basic block, we would like to get rid of the method `getStmtFor(BB)` and its uses. Here we remove one of its uses in PolyhedralInfo, as suggested by Michael Sir.

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser

Subscribers: pollydev

Tags: #polly

Differential Revision: https://reviews.llvm.org/D35300

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

Modified: polly/trunk/lib/Analysis/PolyhedralInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/PolyhedralInfo.cpp?rev=308220&r1=308219&r2=308220&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/PolyhedralInfo.cpp (original)
+++ polly/trunk/lib/Analysis/PolyhedralInfo.cpp Mon Jul 17 13:58:13 2017
@@ -126,25 +126,24 @@ __isl_give isl_union_map *PolyhedralInfo
   DEBUG(dbgs() << "Relative loop depth:\t" << CurrDim << "\n");
   assert(CurrDim >= 0 && "Loop in region should have at least depth one");
 
-  for (auto *BB : L->blocks()) {
-    auto *SS = S->getStmtFor(BB);
-    if (!SS)
-      continue;
+  for (auto &SS : *S) {
+    if (L->contains(SS.getSurroundingLoop())) {
 
-    unsigned int MaxDim = SS->getNumIterators();
-    DEBUG(dbgs() << "Maximum depth of Stmt:\t" << MaxDim << "\n");
-    auto *ScheduleMap = SS->getSchedule();
-    assert(ScheduleMap &&
-           "Schedules that contain extension nodes require special handling.");
+      unsigned int MaxDim = SS.getNumIterators();
+      DEBUG(dbgs() << "Maximum depth of Stmt:\t" << MaxDim << "\n");
+      auto *ScheduleMap = SS.getSchedule();
+      assert(
+          ScheduleMap &&
+          "Schedules that contain extension nodes require special handling.");
 
-    ScheduleMap = isl_map_project_out(ScheduleMap, isl_dim_out, CurrDim + 1,
-                                      MaxDim - CurrDim - 1);
-    ScheduleMap =
-        isl_map_set_tuple_id(ScheduleMap, isl_dim_in, SS->getDomainId());
-    Schedule =
-        isl_union_map_union(Schedule, isl_union_map_from_map(ScheduleMap));
+      ScheduleMap = isl_map_project_out(ScheduleMap, isl_dim_out, CurrDim + 1,
+                                        MaxDim - CurrDim - 1);
+      ScheduleMap =
+          isl_map_set_tuple_id(ScheduleMap, isl_dim_in, SS.getDomainId());
+      Schedule =
+          isl_union_map_union(Schedule, isl_union_map_from_map(ScheduleMap));
+    }
   }
-
   Schedule = isl_union_map_coalesce(Schedule);
   return Schedule;
 }




More information about the llvm-commits mailing list