summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/PPCGCodeGeneration.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-08-04 13:57:29 +0000
committerTobias Grosser <tobias@grosser.es>2016-08-04 13:57:29 +0000
commitf919d8b36071bdacd699e28d7788bb904ba5f23d (patch)
tree7db27beb7f29bd741542c7f1fd2c9e20dd7eea4a /polly/lib/CodeGen/PPCGCodeGeneration.cpp
parentf679530ba18023d29765bde397fa77048bf17985 (diff)
downloadbcm5719-llvm-f919d8b36071bdacd699e28d7788bb904ba5f23d.tar.gz
bcm5719-llvm-f919d8b36071bdacd699e28d7788bb904ba5f23d.zip
GPGPU: Support scalars that are mapped to shared memory
llvm-svn: 277726
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 8b6679b1abf..481e20b54b7 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1252,16 +1252,12 @@ void GPUNodeBuilder::createKernelVariables(ppcg_kernel *Kernel, Function *FN) {
isl_id *Id = isl_space_get_tuple_id(Var.array->space, isl_dim_set);
Type *EleTy = ScopArrayInfo::getFromId(Id)->getElementType();
+ Type *ArrayTy = EleTy;
SmallVector<const SCEV *, 4> Sizes;
- isl_val *V0 = isl_vec_get_element_val(Var.size, 0);
- long Bound = isl_val_get_num_si(V0);
- isl_val_free(V0);
- Sizes.push_back(S.getSE()->getConstant(Builder.getInt64Ty(), Bound));
- ArrayType *ArrayTy = ArrayType::get(EleTy, Bound);
- for (unsigned int j = 1; j < Var.array->n_index; ++j) {
+ for (unsigned int j = 0; j < Var.array->n_index; ++j) {
isl_val *Val = isl_vec_get_element_val(Var.size, j);
- Bound = isl_val_get_num_si(Val);
+ long Bound = isl_val_get_num_si(Val);
isl_val_free(Val);
Sizes.push_back(S.getSE()->getConstant(Builder.getInt64Ty(), Bound));
ArrayTy = ArrayType::get(ArrayTy, Bound);
@@ -1274,8 +1270,8 @@ void GPUNodeBuilder::createKernelVariables(ppcg_kernel *Kernel, Function *FN) {
*M, ArrayTy, false, GlobalValue::InternalLinkage, 0, Var.name,
nullptr, GlobalValue::ThreadLocalMode::NotThreadLocal, 3);
GlobalVar->setAlignment(EleTy->getPrimitiveSizeInBits() / 8);
- ConstantAggregateZero *Zero = ConstantAggregateZero::get(ArrayTy);
- GlobalVar->setInitializer(Zero);
+ GlobalVar->setInitializer(Constant::getNullValue(ArrayTy));
+
Allocation = GlobalVar;
} else if (Var.type == ppcg_access_private) {
Allocation = Builder.CreateAlloca(ArrayTy, 0, "private_array");
OpenPOWER on IntegriCloud