Update for alloca construction changes

llvm-svn: 299905
This commit is contained in:
Matt Arsenault
2017-04-11 00:12:58 +00:00
parent bf80cfe6b6
commit b3e30c32ce
4 changed files with 17 additions and 5 deletions

View File

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

View File

@@ -1212,7 +1212,8 @@ bool IslNodeBuilder::preloadInvariantEquivClass(
}
BasicBlock *EntryBB = &Builder.GetInsertBlock()->getParent()->getEntryBlock();
auto *Alloca = new AllocaInst(AccInstTy, AccInst->getName() + ".preload.s2a");
auto *Alloca = new AllocaInst(AccInstTy, DL.getAllocaAddrSpace(),
AccInst->getName() + ".preload.s2a");
Alloca->insertBefore(&*EntryBB->getFirstInsertionPt());
Builder.CreateStore(PreloadVal, Alloca);
ValueMapT PreloadedPointer;
@@ -1282,7 +1283,8 @@ void IslNodeBuilder::allocateNewArrays() {
auto InstIt =
Builder.GetInsertBlock()->getParent()->getEntryBlock().getTerminator();
auto *CreatedArray = new AllocaInst(NewArrayType, SAI->getName(), &*InstIt);
auto *CreatedArray = new AllocaInst(NewArrayType, DL.getAllocaAddrSpace(),
SAI->getName(), &*InstIt);
CreatedArray->setAlignment(PollyTargetFirstLevelCacheLineSize);
SAI->setBasePtr(CreatedArray);
}

View File

@@ -281,13 +281,17 @@ ParallelLoopGenerator::storeValuesIntoStruct(SetVector<Value *> &Values) {
for (Value *V : Values)
Members.push_back(V->getType());
const DataLayout &DL
= Builder.GetInsertBlock()->getParent()->getParent()->getDataLayout();
// 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
// live span (similar to clang).
BasicBlock &EntryBB = Builder.GetInsertBlock()->getParent()->getEntryBlock();
Instruction *IP = &*EntryBB.getFirstInsertionPt();
StructType *Ty = StructType::get(Builder.getContext(), Members);
AllocaInst *Struct = new AllocaInst(Ty, nullptr, "polly.par.userContext", IP);
AllocaInst *Struct = new AllocaInst(Ty, DL.getAllocaAddrSpace(), nullptr,
"polly.par.userContext", IP);
for (unsigned i = 0; i < Values.size(); i++) {
Value *Address = Builder.CreateStructGEP(Ty, Struct, i);

View File

@@ -170,10 +170,12 @@ void RuntimeDebugBuilder::createGPUPrinterT(PollyIRBuilder &Builder,
ToPrint.push_back(Builder.CreateGlobalStringPtr("\n ", "", 4));
ToPrint.insert(ToPrint.end(), Values.begin(), Values.end());
const DataLayout &DL = Builder.GetInsertBlock()->getModule()->getDataLayout();
// Allocate print buffer (assuming 2*32 bit per element)
auto T = ArrayType::get(Builder.getInt32Ty(), ToPrint.size() * 2);
Value *Data = new AllocaInst(
T, "polly.vprint.buffer",
T, DL.getAllocaAddrSpace(), "polly.vprint.buffer",
&Builder.GetInsertBlock()->getParent()->getEntryBlock().front());
auto *DataPtr = Builder.CreateGEP(Data, {Zero, Zero});