[polly] r247544 - [FIX] Allow the whole SCoP to be a non-affine subregion

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 04:15:07 PDT 2015


Author: jdoerfert
Date: Mon Sep 14 06:15:07 2015
New Revision: 247544

URL: http://llvm.org/viewvc/llvm-project?rev=247544&view=rev
Log:
[FIX] Allow the whole SCoP to be a non-affine subregion

Added:
    polly/trunk/test/Isl/CodeGen/whole-scop-non-affine-subregion.ll
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=247544&r1=247543&r2=247544&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Sep 14 06:15:07 2015
@@ -1518,6 +1518,9 @@ void Scop::buildDomains(Region *R, LoopI
 
   DomainMap[EntryBB] = S;
 
+  if (SD.isNonAffineSubRegion(R, R))
+    return;
+
   buildDomainsWithBranchConstraints(R, LI, SD, DT);
   addLoopBoundsToHeaderDomains(LI, SD, DT);
   propagateDomainConstraints(R, LI, SD, DT);
@@ -2533,6 +2536,15 @@ void Scop::buildSchedule(
     Region *R, LoopInfo &LI, ScopDetection &SD,
     DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules) {
 
+  if (SD.isNonAffineSubRegion(R, &getRegion())) {
+    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];
+    LSchedulePair.first = StmtSchedule;
+    return;
+  }
+
   ReversePostOrderTraversal<Region *> RTraversal(R);
   for (auto *RN : RTraversal) {
 

Added: polly/trunk/test/Isl/CodeGen/whole-scop-non-affine-subregion.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/whole-scop-non-affine-subregion.ll?rev=247544&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/whole-scop-non-affine-subregion.ll (added)
+++ polly/trunk/test/Isl/CodeGen/whole-scop-non-affine-subregion.ll Mon Sep 14 06:15:07 2015
@@ -0,0 +1,35 @@
+; RUN: opt -polly-detect-unprofitable -polly-no-early-exit -polly-codegen %loadPolly < %s
+;
+;    void f(int *A) {
+;      if (*A > 42)
+;        *A = *A + 1;
+;      else
+;        *A = *A - 1;
+;    }
+;
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f(i32* %A) {
+entry:
+  br label %entry.split
+
+entry.split:
+  %tmp = load i32, i32* %A, align 4
+  %cmp = icmp sgt i32 %tmp, 42
+  br i1 %cmp, label %if.then, label %if.else
+
+if.then:                                          ; preds = %entry
+  %tmp1 = load i32, i32* %A, align 4
+  %add = add nsw i32 %tmp1, 1
+  br label %if.end
+
+if.else:                                          ; preds = %entry
+  %tmp2 = load i32, i32* %A, align 4
+  %sub = add nsw i32 %tmp2, -1
+  br label %if.end
+
+if.end:                                           ; preds = %if.else, %if.then
+  %storemerge = phi i32 [ %sub, %if.else ], [ %add, %if.then ]
+  store i32 %storemerge, i32* %A, align 4
+  ret void
+}




More information about the llvm-commits mailing list