[llvm-branch-commits] [polly] r259710 - Merged: https://llvm.org/svn/llvm-project/polly/trunk at 258802

Tobias Grosser via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 3 13:43:10 PST 2016


Author: grosser
Date: Wed Feb  3 15:43:09 2016
New Revision: 259710

URL: http://llvm.org/viewvc/llvm-project?rev=259710&view=rev
Log:
Merged: https://llvm.org/svn/llvm-project/polly/trunk@258802

[FIX] Build correct domain for non-affine region SCoPs

Added:
    polly/branches/release_38/test/ScopInfo/non-affine-region-with-loop.ll
Modified:
    polly/branches/release_38/lib/Analysis/ScopInfo.cpp

Modified: polly/branches/release_38/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_38/lib/Analysis/ScopInfo.cpp?rev=259710&r1=259709&r2=259710&view=diff
==============================================================================
--- polly/branches/release_38/lib/Analysis/ScopInfo.cpp (original)
+++ polly/branches/release_38/lib/Analysis/ScopInfo.cpp Wed Feb  3 15:43:09 2016
@@ -2035,11 +2035,12 @@ void Scop::removeErrorBlockDomains() {
 
 void Scop::buildDomains(Region *R) {
 
+  bool IsOnlyNonAffineRegion = SD.isNonAffineSubRegion(R, R);
   auto *EntryBB = R->getEntry();
-  int LD = getRelativeLoopDepth(LI.getLoopFor(EntryBB));
+  auto *L = IsOnlyNonAffineRegion ? nullptr : LI.getLoopFor(EntryBB);
+  int LD = getRelativeLoopDepth(L);
   auto *S = isl_set_universe(isl_space_set_alloc(getIslCtx(), 0, LD + 1));
 
-  Loop *L = LI.getLoopFor(EntryBB);
   while (LD-- >= 0) {
     S = addDomainDimId(S, LD + 1, L);
     L = L->getParentLoop();
@@ -2047,7 +2048,7 @@ void Scop::buildDomains(Region *R) {
 
   DomainMap[EntryBB] = S;
 
-  if (SD.isNonAffineSubRegion(R, R))
+  if (IsOnlyNonAffineRegion)
     return;
 
   buildDomainsWithBranchConstraints(R);

Added: polly/branches/release_38/test/ScopInfo/non-affine-region-with-loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/branches/release_38/test/ScopInfo/non-affine-region-with-loop.ll?rev=259710&view=auto
==============================================================================
--- polly/branches/release_38/test/ScopInfo/non-affine-region-with-loop.ll (added)
+++ polly/branches/release_38/test/ScopInfo/non-affine-region-with-loop.ll Wed Feb  3 15:43:09 2016
@@ -0,0 +1,41 @@
+; RUN: opt %loadPolly -polly-allow-nonaffine-loops -polly-scops -analyze < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-allow-nonaffine-loops -polly-codegen -analyze
+;
+; CHECK:      Domain :=
+; CHECK-NEXT:   { Stmt_loop2__TO__loop[] };
+;
+define void @foo(i64* %A, i64 %p) {
+entry:
+  br label %loop
+
+loop:
+  %indvar.3 = phi i64 [0, %entry], [%indvar.3, %loop], [%indvar.next.3, %next2], [%indvar.next.3, %cond]
+  %indvar = phi i64 [0, %entry], [%indvar.next, %loop], [0, %next2], [0, %cond]
+  %indvar.next = add i64 %indvar, 1
+  fence seq_cst
+  %cmp = icmp eq i64 %indvar, 100
+  br i1 %cmp, label %next, label %loop
+
+next:
+  %indvar.next.3 = add i64 %indvar.3, 1
+  %cmp.3 = icmp eq i64 %indvar, 100
+  br i1 %cmp.3, label %loop2, label %exit
+
+loop2:
+  %indvar.2 = phi i64 [0, %next], [%indvar.next.2, %loop2], [0, %cond]
+  %indvar.next.2 = add i64 %indvar.2, 1
+  %prod = mul i64 %indvar.2, %indvar.2
+  store i64 %indvar, i64* %A
+  %cmp.2 = icmp eq i64 %prod, 100
+  br i1 %cmp.2, label %loop2, label %next2
+
+next2:
+  %cmp.4 = icmp eq i64 %p, 100
+  br i1 %cmp.4, label %loop, label %cond
+
+cond:
+  br i1 false, label %loop, label %loop2
+
+exit:
+  ret void
+}




More information about the llvm-branch-commits mailing list