ScopInfo: Use names of simple parameters to name the isl parameter dimensions.

Parameters can be complex SCEV expressions, but they can also be single scalar
values. If a parameters is such a simple scalar value and the value is named,
use this name to name the isl parameter dimensions.

llvm-svn: 144641
This commit is contained in:
Tobias Grosser 2011-11-15 11:38:55 +00:00
parent 1fb76bd6f7
commit 8f99c167cd
6 changed files with 41 additions and 32 deletions

View File

@ -870,7 +870,16 @@ __isl_give isl_id *Scop::getIdForParam(const SCEV *Parameter) const {
if (IdIter == ParameterIds.end())
return NULL;
std::string ParameterName = "p" + convertInt(IdIter->second);
std::string ParameterName;
if (const SCEVUnknown *ValueParameter = dyn_cast<SCEVUnknown>(Parameter)) {
Value *Val = ValueParameter->getValue();
ParameterName = Val->getNameStr();
}
if (ParameterName == "" || ParameterName.substr(0, 2) == "p_")
ParameterName = "p_" + convertInt(IdIter->second);
return isl_id_alloc(getIslCtx(), ParameterName.c_str(), (void *) Parameter);
}

View File

@ -132,11 +132,11 @@ return: ; preds = %for.end35, %if.then
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
; CHECK: for (c2=0;c2<=min(1023,M+1024);c2++) {
; CHECK: for (c2=0;c2<=min(1023,m+1024);c2++) {
; CHECK: Stmt_if_then(c2);
; CHECK: Stmt_if_end(c2);
; CHECK: }
; CHECK: for (c2=max(0,M+1025);c2<=1023;c2++) {
; CHECK: for (c2=max(0,m+1025);c2<=1023;c2++) {
; CHECK: Stmt_if_else(c2);
; CHECK: Stmt_if_end(c2);
; CHECK: }

View File

@ -70,8 +70,8 @@ bb9: ; preds = %bb8, %bb5
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
; CHECK: if (M >= 1) {
; CHECK: for (c2=0;c2<=M-1;c2++) {
; CHECK: if (n >= 1) {
; CHECK: for (c2=0;c2<=n-1;c2++) {
; CHECK: Stmt_bb2(c2);
; CHECK: }
; CHECK: }

View File

@ -29,18 +29,18 @@ bb2: ; preds = %bb2, %.lr.ph
ret void
}
; CHECK: if (M >= 1) {
; CHECK: for (c1=0;c1<=M-1;c1+=32) {
; CHECK: for (c2=c1;c2<=min(M-1,c1+31);c2++) {
; CHECK: if (p_0 >= 1) {
; CHECK: for (c1=0;c1<=p_0-1;c1+=32) {
; CHECK: for (c2=c1;c2<=min(c1+31,p_0-1);c2++) {
; CHECK: Stmt_bb2(c2);
; CHECK: }
; CHECK: }
; CHECK: }
; VECTOR: if (M >= 1) {
; VECTOR: for (c1=0;c1<=M-1;c1+=32) {
; VECTOR: for (c2=-4*floord(-c1,4);c2<=min(M-1,c1+31);c2+=4) {
; VECTOR: for (c3=c2;c3<=min(M-1,c2+3);c3++) {
; VECTOR: if (p_0 >= 1) {
; VECTOR: for (c1=0;c1<=p_0-1;c1+=32) {
; VECTOR: for (c2=-4*floord(-c1,4);c2<=min(c1+31,p_0-1);c2+=4) {
; VECTOR: for (c3=c2;c3<=min(c2+3,p_0-1);c3++) {
; VECTOR: Stmt_bb2(c3);
; VECTOR: }
; VECTOR: }

View File

@ -52,5 +52,5 @@ for.end7: ; preds = %for.cond
}
; CHECK: Domain :=
; CHECK: [p0] -> { Stmt_if_then[i0] : i0 >= 0 and i0 <= 1022 and i0 >= 1001 - p0 };
; CHECK: [p_0] -> { Stmt_if_then[i0] : i0 >= 0 and i0 <= 1022 and i0 >= 1001 - p_0 };

View File

@ -47,46 +47,46 @@ bb2: ; preds = %bb, %entry
}
; CHECK: Context:
; CHECK: [p0] -> { : }
; CHECK: [n] -> { : }
; CHECK: Statements {
; CHECK: Stmt_bb_nph
; CHECK: Domain :=
; CHECK: [p0] -> { Stmt_bb_nph[] : p0 >= 2 };
; CHECK: [n] -> { Stmt_bb_nph[] : n >= 2 };
; CHECK: Scattering :=
; CHECK: [p0] -> { Stmt_bb_nph[] -> scattering[0, 0, 0] };
; CHECK: [n] -> { Stmt_bb_nph[] -> scattering[0, 0, 0] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { Stmt_bb_nph[] -> MemRef_a[0] };
; CHECK: [n] -> { Stmt_bb_nph[] -> MemRef_a[0] };
; CHECK: WriteAccess :=
; CHECK: [p0] -> { Stmt_bb_nph[] -> MemRef_k_05_reg2mem[0] };
; CHECK: [n] -> { Stmt_bb_nph[] -> MemRef_k_05_reg2mem[0] };
; CHECK: WriteAccess :=
; CHECK: [p0] -> { Stmt_bb_nph[] -> MemRef__reg2mem[0] };
; CHECK: [n] -> { Stmt_bb_nph[] -> MemRef__reg2mem[0] };
; CHECK: Stmt_bb
; CHECK: Domain :=
; CHECK: [p0] -> { Stmt_bb[i0] : i0 >= 0 and i0 <= -2 + p0 and p0 >= 2 };
; CHECK: [n] -> { Stmt_bb[i0] : i0 >= 0 and i0 <= -2 + n and n >= 2 };
; CHECK: Scattering :=
; CHECK: [p0] -> { Stmt_bb[i0] -> scattering[1, i0, 0] };
; CHECK: [n] -> { Stmt_bb[i0] -> scattering[1, i0, 0] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef__reg2mem[0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef__reg2mem[0] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef_k_05_reg2mem[0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef_k_05_reg2mem[0] };
; CHECK: WriteAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef_a[1 + i0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef_a[1 + i0] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef_a[2 + 2i0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef_a[2 + 2i0] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef_a[4 + i0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef_a[4 + i0] };
; CHECK: WriteAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef_k_05_reg2mem[0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef_k_05_reg2mem[0] };
; CHECK: WriteAccess :=
; CHECK: [p0] -> { Stmt_bb[i0] -> MemRef__reg2mem[0] };
; CHECK: [n] -> { Stmt_bb[i0] -> MemRef__reg2mem[0] };
; CHECK: FinalRead
; CHECK: Domain :=
; CHECK: [p0] -> { FinalRead[0] };
; CHECK: [n] -> { FinalRead[0] };
; CHECK: Scattering :=
; CHECK: [p0] -> { FinalRead[i0] -> scattering[200000000, o1, o2] };
; CHECK: [n] -> { FinalRead[i0] -> scattering[200000000, o1, o2] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { FinalRead[i0] -> MemRef_a[o0] };
; CHECK: [n] -> { FinalRead[i0] -> MemRef_a[o0] };
; CHECK: ReadAccess :=
; CHECK: [p0] -> { FinalRead[i0] -> MemRef_k_05_reg2mem[o0] };
; CHECK: [n] -> { FinalRead[i0] -> MemRef_k_05_reg2mem[o0] };
; CHECK: ReadAccess :=
; CHECK: -> { FinalRead[i0] -> MemRef__reg2mem[o0] };