[polly] r214665 - Do allow negative offsets in the outermost array dimension
Tobias Grosser
tobias at grosser.es
Sun Aug 3 14:07:30 PDT 2014
Author: grosser
Date: Sun Aug 3 16:07:30 2014
New Revision: 214665
URL: http://llvm.org/viewvc/llvm-project?rev=214665&view=rev
Log:
Do allow negative offsets in the outermost array dimension
There is no needed for neither 1-dimensional nor higher dimensional arrays to
require positive offsets in the outermost array dimension.
We originally introduced this assumption with the support for delinearizing
multi-dimensional arrays.
Added:
polly/trunk/test/ScopInfo/multidim_2d_outer_parametric_offset.ll
- copied, changed from r214633, polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll
Removed:
polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll
Modified:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/test/Isl/Ast/simple-run-time-condition.ll
polly/trunk/test/ScopInfo/multidim_ivs_and_parameteric_offsets_3d.ll
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=214665&r1=214664&r2=214665&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun Aug 3 16:07:30 2014
@@ -366,9 +366,9 @@ isl_basic_map *MemoryAccess::createBasic
// expression of each array evaluates for each statement instance that is
// executed to a value that is larger than zero and strictly smaller than the
// size of the corresponding dimension). The only exception is the outermost
-// dimension for which we do not assume any upper bound. At this point we
-// formalize this assumption to ensure that at code generation time the relevant
-// run-time checks can be generated.
+// dimension for which we do not need to assume any upper bound. At this point
+// we formalize this assumption to ensure that at code generation time the
+// relevant run-time checks can be generated.
//
// To find the set of constraints necessary to avoid out of bound accesses, we
// first build the set of data locations that are not within array bounds. We
@@ -383,7 +383,7 @@ isl_basic_map *MemoryAccess::createBasic
void MemoryAccess::assumeNoOutOfBound(const IRAccess &Access) {
isl_space *Space = isl_space_range(getAccessRelationSpace());
isl_set *Outside = isl_set_empty(isl_space_copy(Space));
- for (int i = 0, Size = Access.Subscripts.size(); i < Size; ++i) {
+ for (int i = 1, Size = Access.Subscripts.size(); i < Size; ++i) {
isl_local_space *LS = isl_local_space_from_space(isl_space_copy(Space));
isl_pw_aff *Var =
isl_pw_aff_var_on_domain(isl_local_space_copy(LS), isl_dim_set, i);
@@ -391,22 +391,17 @@ void MemoryAccess::assumeNoOutOfBound(co
isl_set *DimOutside;
- if (i == 0) {
- DimOutside = isl_pw_aff_lt_set(Var, Zero);
- } else {
- DimOutside = isl_pw_aff_lt_set(isl_pw_aff_copy(Var), Zero);
- isl_pw_aff *SizeE =
- SCEVAffinator::getPwAff(Statement, Access.Sizes[i - 1]);
+ DimOutside = isl_pw_aff_lt_set(isl_pw_aff_copy(Var), Zero);
+ isl_pw_aff *SizeE = SCEVAffinator::getPwAff(Statement, Access.Sizes[i - 1]);
- SizeE = isl_pw_aff_drop_dims(SizeE, isl_dim_in, 0,
- Statement->getNumIterators());
- SizeE = isl_pw_aff_add_dims(SizeE, isl_dim_in,
- isl_space_dim(Space, isl_dim_set));
- SizeE = isl_pw_aff_set_tuple_id(
- SizeE, isl_dim_in, isl_space_get_tuple_id(Space, isl_dim_set));
+ SizeE = isl_pw_aff_drop_dims(SizeE, isl_dim_in, 0,
+ Statement->getNumIterators());
+ SizeE = isl_pw_aff_add_dims(SizeE, isl_dim_in,
+ isl_space_dim(Space, isl_dim_set));
+ SizeE = isl_pw_aff_set_tuple_id(SizeE, isl_dim_in,
+ isl_space_get_tuple_id(Space, isl_dim_set));
- DimOutside = isl_set_union(DimOutside, isl_pw_aff_le_set(SizeE, Var));
- }
+ DimOutside = isl_set_union(DimOutside, isl_pw_aff_le_set(SizeE, Var));
Outside = isl_set_union(Outside, DimOutside);
}
Modified: polly/trunk/test/Isl/Ast/simple-run-time-condition.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/simple-run-time-condition.ll?rev=214665&r1=214664&r2=214665&view=diff
==============================================================================
--- polly/trunk/test/Isl/Ast/simple-run-time-condition.ll (original)
+++ polly/trunk/test/Isl/Ast/simple-run-time-condition.ll Sun Aug 3 16:07:30 2014
@@ -18,7 +18,7 @@ target triple = "x86_64-unknown-linux-gn
; for the delinearization is simplified such that conditions that would not
; cause any code to be executed are not generated.
-; CHECK: if ((q == 100 && o <= 0 && p >= 0) || (q == 0 && o >= 1 && p >= 0) ? 1 : 0)
+; CHECK: if ((q == 100 && o <= 0) || (q == 0 && o >= 1) ? 1 : 0)
; CHECK: if (o >= 1) {
; CHECK: for (int c1 = 0; c1 < n; c1 += 1)
Removed: polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll?rev=214664&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll (original)
+++ polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll (removed)
@@ -1,53 +0,0 @@
-; RUN: opt %loadPolly -polly-scops -analyze -polly-delinearize < %s | FileCheck %s
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; Derived from the following code:
-;
-; void foo(long n, long m, long p, double A[n][m]) {
-; for (long i = 0; i < 100; i++)
-; for (long j = 0; j < m; j++)
-; A[i+p][j] = 1.0;
-; }
-
-; CHECK: Assumed Context:
-; CHECK: [m, p] -> { : p >= 0 }
-; CHECK: p0: %m
-; CHECK: p1: %p
-; CHECK: Statements {
-; CHECK: Stmt_for_j
-; CHECK: Domain :=
-; CHECK: [m, p] -> { Stmt_for_j[i0, i1] : i0 >= 0 and i0 <= 99 and i1 >= 0 and i1 <= -1 + m };
-; CHECK: Scattering :=
-; CHECK: [m, p] -> { Stmt_for_j[i0, i1] -> scattering[0, i0, 0, i1, 0] };
-; CHECK: MustWriteAccess := [Reduction Type: NONE]
-; CHECK: [m, p] -> { Stmt_for_j[i0, i1] -> MemRef_A[p + i0, i1] };
-; CHECK: }
-
-define void @foo(i64 %n, i64 %m, i64 %p, double* %A) {
-entry:
- br label %for.i
-
-for.i:
- %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ]
- %add = add nsw i64 %i, %p
- %tmp = mul nsw i64 %add, %m
- br label %for.j
-
-for.j:
- %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j ]
- %vlaarrayidx.sum = add i64 %j, %tmp
- %arrayidx = getelementptr inbounds double* %A, i64 %vlaarrayidx.sum
- store double 1.0, double* %arrayidx
- %j.inc = add nsw i64 %j, 1
- %j.exitcond = icmp eq i64 %j.inc, %m
- br i1 %j.exitcond, label %for.i.inc, label %for.j
-
-for.i.inc:
- %i.inc = add nsw i64 %i, 1
- %i.exitcond = icmp eq i64 %i.inc, 100
- br i1 %i.exitcond, label %end, label %for.i
-
-end:
- ret void
-}
Copied: polly/trunk/test/ScopInfo/multidim_2d_outer_parametric_offset.ll (from r214633, polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll)
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/multidim_2d_outer_parametric_offset.ll?p2=polly/trunk/test/ScopInfo/multidim_2d_outer_parametric_offset.ll&p1=polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll&r1=214633&r2=214665&rev=214665&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/multidim_2d_outer_larger_than_zero.ll (original)
+++ polly/trunk/test/ScopInfo/multidim_2d_outer_parametric_offset.ll Sun Aug 3 16:07:30 2014
@@ -11,7 +11,7 @@ target triple = "x86_64-unknown-linux-gn
; }
; CHECK: Assumed Context:
-; CHECK: [m, p] -> { : p >= 0 }
+; CHECK: [m, p] -> { : }
; CHECK: p0: %m
; CHECK: p1: %p
; CHECK: Statements {
Modified: polly/trunk/test/ScopInfo/multidim_ivs_and_parameteric_offsets_3d.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/multidim_ivs_and_parameteric_offsets_3d.ll?rev=214665&r1=214664&r2=214665&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/multidim_ivs_and_parameteric_offsets_3d.ll (original)
+++ polly/trunk/test/ScopInfo/multidim_ivs_and_parameteric_offsets_3d.ll Sun Aug 3 16:07:30 2014
@@ -15,7 +15,7 @@ target triple = "x86_64-unknown-linux-gn
; (8 * %o)}<%for.j>,+,8}<%for.k>
; CHECK: Assumed Context:
-; CHECK: [n, m, o, p, q, r] -> { : q = 0 and r = 0 and p >= 0 }
+; CHECK: [n, m, o, p, q, r] -> { : q = 0 and r = 0 }
;
; CHECK: p0: %n
; CHECK: p1: %m
More information about the llvm-commits
mailing list