ScopInfo: Align parameters when using -polly-allow-nonaffine

This ensures that the isl sets/maps we operate on have the same parameter
dimensions. Operations on objects with different parameter dimensions are not
allow and trigger assertions.

llvm-svn: 163618
This commit is contained in:
Tobias Grosser 2012-09-11 13:50:21 +00:00
parent 4464613ceb
commit ed29566c4e
2 changed files with 38 additions and 0 deletions

View File

@ -270,6 +270,7 @@ isl_map *MemoryAccess::getNewAccessRelation() const {
isl_basic_map *MemoryAccess::createBasicAccessMap(ScopStmt *Statement) {
isl_space *Space = isl_space_set_alloc(Statement->getIslCtx(), 0, 1);
Space = isl_space_set_tuple_name(Space, isl_dim_set, getBaseName().c_str());
Space = isl_space_align_params(Space, Statement->getDomainSpace());
return isl_basic_map_from_domain_and_range(
isl_basic_set_universe(Statement->getDomainSpace()),

View File

@ -0,0 +1,37 @@
; RUN: opt %loadPolly -basicaa -polly-scops -analyze -polly-allow-nonaffine < %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"
; void foo(long n, double A[], int INDEX[]) {
; for (long i = 0; i < n; i++)
; A[INDEX[i]] = i;
; }
define void @foo(i64 %n, double* noalias %A, i64* noalias %INDEX) {
entry:
br label %for.body
for.body:
%i = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64* %INDEX, i64 %i
%val = load i64* %arrayidx
%arrayidx1 = getelementptr inbounds double* %A, i64 %val
store double 1.0, double* %arrayidx1
%inc = add nsw i64 %i, 1
%exitcond = icmp eq i64 %inc, %n
br i1 %exitcond, label %for.end, label %for.body
for.end:
ret void
}
; CHECK: p0: %n
; CHECK: Domain
; CHECK: [n] -> { Stmt_for_body[i0] : i0 >= 0 and i0 <= -1 + n };
; CHECK: Scattering
; CHECK: [n] -> { Stmt_for_body[i0] -> scattering[0, i0, 0] };
; CHECK: ReadAccess
; CHECK: [n] -> { Stmt_for_body[i0] -> MemRef_INDEX[i0] };
; CHECK: WriteAccess
; CHECK: [n] -> { Stmt_for_body[i0] -> MemRef_A[o0] };