[polly] r299905 - Update for alloca construction changes
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 10 17:12:58 PDT 2017
Author: arsenm
Date: Mon Apr 10 19:12:58 2017
New Revision: 299905
URL: http://llvm.org/viewvc/llvm-project?rev=299905&view=rev
Log:
Update for alloca construction changes
Modified:
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
polly/trunk/lib/CodeGen/LoopGenerators.cpp
polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=299905&r1=299904&r2=299905&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Mon Apr 10 19:12:58 2017
@@ -408,7 +408,11 @@ Value *BlockGenerator::getOrCreateAlloca
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());
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=299905&r1=299904&r2=299905&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Mon Apr 10 19:12:58 2017
@@ -1212,7 +1212,8 @@ bool IslNodeBuilder::preloadInvariantEqu
}
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);
}
Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.cpp?rev=299905&r1=299904&r2=299905&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Mon Apr 10 19:12:58 2017
@@ -281,13 +281,17 @@ ParallelLoopGenerator::storeValuesIntoSt
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);
Modified: polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp?rev=299905&r1=299904&r2=299905&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp Mon Apr 10 19:12:58 2017
@@ -170,10 +170,12 @@ void RuntimeDebugBuilder::createGPUPrint
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});
More information about the llvm-commits
mailing list