mirror of
https://github.com/intel/llvm.git
synced 2026-02-08 17:28:30 +08:00
GPGPU: Sort dimension sizes of multi-dimensional shared memory arrays correctly
Before this commit we generated the array type in reverse order and we also added the outermost dimension size to the new array declaration, which is incorrect as Polly additionally assumed an additional unsized outermost dimension, such that we had an off-by-one error in the linearization of access expressions. llvm-svn: 277802
This commit is contained in:
@@ -1292,11 +1292,17 @@ void GPUNodeBuilder::createKernelVariables(ppcg_kernel *Kernel, Function *FN) {
|
||||
Type *ArrayTy = EleTy;
|
||||
SmallVector<const SCEV *, 4> Sizes;
|
||||
|
||||
for (unsigned int j = 0; j < Var.array->n_index; ++j) {
|
||||
for (unsigned int j = 1; j < Var.array->n_index; ++j) {
|
||||
isl_val *Val = isl_vec_get_element_val(Var.size, j);
|
||||
long Bound = isl_val_get_num_si(Val);
|
||||
isl_val_free(Val);
|
||||
Sizes.push_back(S.getSE()->getConstant(Builder.getInt64Ty(), Bound));
|
||||
}
|
||||
|
||||
for (int j = Var.array->n_index - 1; j >= 0; --j) {
|
||||
isl_val *Val = isl_vec_get_element_val(Var.size, j);
|
||||
long Bound = isl_val_get_num_si(Val);
|
||||
isl_val_free(Val);
|
||||
ArrayTy = ArrayType::get(ArrayTy, Bound);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user