[polly] r248667 - [FIX] Use the surrounding loop for non-affine SCoP regions

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 26 06:41:44 PDT 2015


Author: jdoerfert
Date: Sat Sep 26 08:41:43 2015
New Revision: 248667

URL: http://llvm.org/viewvc/llvm-project?rev=248667&view=rev
Log:
[FIX] Use the surrounding loop for non-affine SCoP regions

  When the whole SCoP is a non-affine region we need to use the
  surrounding loop in the construction of the schedule as that is
  the one that will be looked up after the schedule generation.

  This fixes bug 24947


Added:
    polly/trunk/test/ScopInfo/NonAffine/whole-scop-non-affine-subregion-in-loop.ll
Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=248667&r1=248666&r2=248667&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Sat Sep 26 08:41:43 2015
@@ -1168,9 +1168,10 @@ private:
 
   /// @brief Build Schedule and ScopStmts.
   ///
-  /// @param R  The current region traversed.
-  /// @param LI The LoopInfo object.
-  /// @param SD The ScopDetection object.
+  /// @param R              The current region traversed.
+  /// @param LI             The LoopInfo object.
+  /// @param SD             The ScopDetection object.
+  /// @param LoopSchedules  Map from loops to their schedule and progress.
   void buildSchedule(
       Region *R, LoopInfo &LI, ScopDetection &SD,
       DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules);

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=248667&r1=248666&r2=248667&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sat Sep 26 08:41:43 2015
@@ -2645,7 +2645,8 @@ void Scop::buildSchedule(
     auto *Stmt = addScopStmt(nullptr, R);
     auto *UDomain = isl_union_set_from_set(Stmt->getDomain());
     auto *StmtSchedule = isl_schedule_from_domain(UDomain);
-    auto &LSchedulePair = LoopSchedules[nullptr];
+    Loop *L = getLoopSurroundingRegion(*R, LI);
+    auto &LSchedulePair = LoopSchedules[L];
     LSchedulePair.first = StmtSchedule;
     return;
   }

Added: polly/trunk/test/ScopInfo/NonAffine/whole-scop-non-affine-subregion-in-loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/whole-scop-non-affine-subregion-in-loop.ll?rev=248667&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/whole-scop-non-affine-subregion-in-loop.ll (added)
+++ polly/trunk/test/ScopInfo/NonAffine/whole-scop-non-affine-subregion-in-loop.ll Sat Sep 26 08:41:43 2015
@@ -0,0 +1,30 @@
+; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s
+;
+; Regression test that triggered a memory leak at some point (24947).
+;
+define void @snrm2() {
+entry:
+  br label %for.body.56.lr.ph
+
+for.body.56.lr.ph:                                ; preds = %entry
+  br label %for.body.56
+
+for.body.56:                                      ; preds = %for.inc.106, %for.body.56.lr.ph
+  br label %if.end.73
+
+if.end.73:                                        ; preds = %for.body.56
+  %cmp82 = fcmp ogt float undef, undef
+  br i1 %cmp82, label %if.then.84, label %if.end.100
+
+if.then.84:                                       ; preds = %if.end.73
+  br label %for.inc.106
+
+if.end.100:                                       ; preds = %if.end.73
+  br label %for.inc.106
+
+for.inc.106:                                      ; preds = %if.end.100, %if.then.84
+  br i1 undef, label %for.body.56, label %for.end.110
+
+for.end.110:                                      ; preds = %for.inc.106
+  ret void
+}




More information about the llvm-commits mailing list