summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp6
-rw-r--r--polly/lib/CodeGen/IslNodeBuilder.cpp6
-rw-r--r--polly/lib/CodeGen/LoopGenerators.cpp6
-rw-r--r--polly/lib/CodeGen/RuntimeDebugBuilder.cpp4
4 files changed, 17 insertions, 5 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 8f9e0577c17..ae5dc3aedf8 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -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());
diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index 739d1f7453e..d8a13d82ebd 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -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);
}
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index 564e7120647..de8a21d2fc0 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -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);
diff --git a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp
index bcc654b7e14..16a7a4c8608 100644
--- a/polly/lib/CodeGen/RuntimeDebugBuilder.cpp
+++ b/polly/lib/CodeGen/RuntimeDebugBuilder.cpp
@@ -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});
OpenPOWER on IntegriCloud