[llvm-commits] [polly] r146149 - in /polly/trunk: lib/ScheduleOptimizer.cpp test/ScheduleOptimizer/2011-08-25-crash_in_vectorizer.ll

Tobias Grosser grosser at fim.uni-passau.de
Thu Dec 8 05:02:58 PST 2011


Author: grosser
Date: Thu Dec  8 07:02:58 2011
New Revision: 146149

URL: http://llvm.org/viewvc/llvm-project?rev=146149&view=rev
Log:
ScheduleOptimizer: Do not tile bands with just one dimension

Modified:
    polly/trunk/lib/ScheduleOptimizer.cpp
    polly/trunk/test/ScheduleOptimizer/2011-08-25-crash_in_vectorizer.ll

Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=146149&r1=146148&r2=146149&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Thu Dec  8 07:02:58 2011
@@ -200,27 +200,34 @@
 
 // getScheduleForBand - Get the schedule for this band.
 //
-// In case tiling is enabled, the schedule of the band is tiled.
-isl_union_map *getScheduleForBand(isl_band *Band) {
+// Polly applies transformations like tiling on top of the isl calculated value.
+// This can influence the number of scheduling dimension. The number of
+// schedule dimensions is returned in the parameter 'Dimension'.
+isl_union_map *getScheduleForBand(isl_band *Band, int *Dimensions) {
   isl_union_map *PartialSchedule;
-  int Dimensions;
   isl_ctx *ctx;
   isl_space *Space;
   isl_basic_map *TileMap;
   isl_union_map *TileUMap;
 
   PartialSchedule = isl_band_get_partial_schedule(Band);
+  *Dimensions = isl_band_n_member(Band);
 
   if (DisableTiling)
     return PartialSchedule;
 
+  // It does not make any sense to tile a band with just one dimension.
+  if (*Dimensions == 1)
+    return PartialSchedule;
+
   ctx = isl_union_map_get_ctx(PartialSchedule);
   Space = isl_union_map_get_space(PartialSchedule);
-  Dimensions = isl_band_n_member(Band);
 
-  TileMap = getTileMap(ctx, Dimensions, Space);
+  TileMap = getTileMap(ctx, *Dimensions, Space);
   TileUMap = isl_union_map_from_map(isl_map_from_basic_map(TileMap));
   TileUMap = isl_union_map_align_params(TileUMap, Space);
+  *Dimensions = 2 * *Dimensions;
+
   return isl_union_map_apply_range(PartialSchedule, TileUMap);
 }
 
@@ -348,8 +355,7 @@
     isl_space *Space;
 
     Band = isl_band_list_get_band(BandList, i);
-    PartialSchedule = getScheduleForBand(Band);
-    ScheduleDimensions = isl_band_n_member(Band);
+    PartialSchedule = getScheduleForBand(Band, &ScheduleDimensions);
     Space = isl_union_map_get_space(PartialSchedule);
 
     if (isl_band_has_children(Band)) {
@@ -367,8 +373,7 @@
           isl_map *TileMap;
           isl_union_map *TileUMap;
 
-	  TileMap = getPrevectorMap(ctx, ScheduleDimensions + i,
-				    ScheduleDimensions * 2);
+	  TileMap = getPrevectorMap(ctx, i, ScheduleDimensions);
 	  TileUMap = isl_union_map_from_map(TileMap);
           TileUMap = isl_union_map_align_params(TileUMap,
                                                 isl_space_copy(Space));

Modified: polly/trunk/test/ScheduleOptimizer/2011-08-25-crash_in_vectorizer.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScheduleOptimizer/2011-08-25-crash_in_vectorizer.ll?rev=146149&r1=146148&r2=146149&view=diff
==============================================================================
--- polly/trunk/test/ScheduleOptimizer/2011-08-25-crash_in_vectorizer.ll (original)
+++ polly/trunk/test/ScheduleOptimizer/2011-08-25-crash_in_vectorizer.ll Thu Dec  8 07:02:58 2011
@@ -30,21 +30,15 @@
 }
 
 ; CHECK: if (p_0 >= 1) {
-; CHECK:     for (c1=0;c1<=p_0-1;c1+=32) {
-; CHECK:           for (c2=c1;c2<=min(c1+31,p_0-1);c2++) {
-; CHECK:                   Stmt_bb2(c2);
-; CHECK:           }
+; CHECK:     for (c1=0;c1<=p_0-1;c1++) {
+; CHECK:         Stmt_bb2(c1);
 ; CHECK:     }
 ; CHECK: }
 
 ; VECTOR: if (p_0 >= 1) {
-; VECTOR:   for (c1=0;c1<=p_0-1;c1+=32) {
-; VECTOR:     for (c2=-4*floord(-c1,4);c2<=min(c1+31,p_0-1);c2+=4) {
-; VECTOR:       for (c3=c2;c3<=min(c2+3,p_0-1);c3++) {
-; VECTOR:         Stmt_bb2(c3);
-; VECTOR:       }
+; VECTOR:   for (c1=0;c1<=p_0-1;c1+=4) {
+; VECTOR:     for (c2=c1;c2<=min(c1+3,p_0-1);c2++) {
+; VECTOR:       Stmt_bb2(c2);
 ; VECTOR:     }
 ; VECTOR:   }
 ; VECTOR: }
-
-





More information about the llvm-commits mailing list