SAdjust to recent change in constructor definition of AllocaInst

llvm-svn: 299913
This commit is contained in:
Tobias Grosser 2017-04-11 04:23:38 +00:00
parent 92ce1e76c5
commit 67726b3260
3 changed files with 23 additions and 18 deletions

View File

@ -408,8 +408,8 @@ Value *BlockGenerator::getOrCreateAlloca(const ScopArrayInfo *Array) {
else else
NameExt = ".s2a"; NameExt = ".s2a";
const DataLayout &DL const DataLayout &DL =
= Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout(); Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout();
Addr = new AllocaInst(Ty, DL.getAllocaAddrSpace(), Addr = new AllocaInst(Ty, DL.getAllocaAddrSpace(),
ScalarBase->getName() + NameExt); ScalarBase->getName() + NameExt);

View File

@ -281,8 +281,8 @@ ParallelLoopGenerator::storeValuesIntoStruct(SetVector<Value *> &Values) {
for (Value *V : Values) for (Value *V : Values)
Members.push_back(V->getType()); Members.push_back(V->getType());
const DataLayout &DL const DataLayout &DL =
= Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout(); Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout();
// We do not want to allocate the alloca inside any loop, thus we allocate it // We do not want to allocate the alloca inside any loop, thus we allocate it
// in the entry block of the function and use annotations to denote the actual // in the entry block of the function and use annotations to denote the actual

View File

@ -1083,9 +1083,10 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
BasicBlock *EntryBlock = BasicBlock *EntryBlock =
&Builder.GetInsertBlock()->getParent()->getEntryBlock(); &Builder.GetInsertBlock()->getParent()->getEntryBlock();
auto AddressSpace = F->getParent()->getDataLayout().getAllocaAddrSpace();
std::string Launch = "polly_launch_" + std::to_string(Kernel->id); std::string Launch = "polly_launch_" + std::to_string(Kernel->id);
Instruction *Parameters = Instruction *Parameters = new AllocaInst(
new AllocaInst(ArrayTy, Launch + "_params", EntryBlock->getTerminator()); ArrayTy, AddressSpace, Launch + "_params", EntryBlock->getTerminator());
int Index = 0; int Index = 0;
for (long i = 0; i < Prog->n_array; i++) { for (long i = 0; i < Prog->n_array; i++) {
@ -1115,9 +1116,10 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
Builder.CreatePointerCast(ValPtr, Builder.getInt8PtrTy()); Builder.CreatePointerCast(ValPtr, Builder.getInt8PtrTy());
Builder.CreateStore(ValPtrCast, Slot); Builder.CreateStore(ValPtrCast, Slot);
} else { } else {
Instruction *Param = new AllocaInst( Instruction *Param =
Builder.getInt8PtrTy(), Launch + "_param_" + std::to_string(Index), new AllocaInst(Builder.getInt8PtrTy(), AddressSpace,
EntryBlock->getTerminator()); Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(DevArray, Param); Builder.CreateStore(DevArray, Param);
Value *ParamTyped = Value *ParamTyped =
Builder.CreatePointerCast(Param, Builder.getInt8PtrTy()); Builder.CreatePointerCast(Param, Builder.getInt8PtrTy());
@ -1132,9 +1134,10 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_set, i); isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_set, i);
Value *Val = IDToValue[Id]; Value *Val = IDToValue[Id];
isl_id_free(Id); isl_id_free(Id);
Instruction *Param = new AllocaInst( Instruction *Param =
Val->getType(), Launch + "_param_" + std::to_string(Index), new AllocaInst(Val->getType(), AddressSpace,
EntryBlock->getTerminator()); Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param); Builder.CreateStore(Val, Param);
Value *Slot = Builder.CreateGEP( Value *Slot = Builder.CreateGEP(
Parameters, {Builder.getInt64(0), Builder.getInt64(Index)}); Parameters, {Builder.getInt64(0), Builder.getInt64(Index)});
@ -1150,9 +1153,10 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_param, i); isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_param, i);
Value *Val = IDToValue[Id]; Value *Val = IDToValue[Id];
isl_id_free(Id); isl_id_free(Id);
Instruction *Param = new AllocaInst( Instruction *Param =
Val->getType(), Launch + "_param_" + std::to_string(Index), new AllocaInst(Val->getType(), AddressSpace,
EntryBlock->getTerminator()); Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param); Builder.CreateStore(Val, Param);
Value *Slot = Builder.CreateGEP( Value *Slot = Builder.CreateGEP(
Parameters, {Builder.getInt64(0), Builder.getInt64(Index)}); Parameters, {Builder.getInt64(0), Builder.getInt64(Index)});
@ -1163,9 +1167,10 @@ GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Function *F,
} }
for (auto Val : SubtreeValues) { for (auto Val : SubtreeValues) {
Instruction *Param = new AllocaInst( Instruction *Param =
Val->getType(), Launch + "_param_" + std::to_string(Index), new AllocaInst(Val->getType(), AddressSpace,
EntryBlock->getTerminator()); Launch + "_param_" + std::to_string(Index),
EntryBlock->getTerminator());
Builder.CreateStore(Val, Param); Builder.CreateStore(Val, Param);
Value *Slot = Builder.CreateGEP( Value *Slot = Builder.CreateGEP(
Parameters, {Builder.getInt64(0), Builder.getInt64(Index)}); Parameters, {Builder.getInt64(0), Builder.getInt64(Index)});