[polly] r234131 - [opaque pointer type] More GEP API migrations
David Blaikie
dblaikie at gmail.com
Sun Apr 5 15:51:12 PDT 2015
Author: dblaikie
Date: Sun Apr 5 17:51:12 2015
New Revision: 234131
URL: http://llvm.org/viewvc/llvm-project?rev=234131&view=rev
Log:
[opaque pointer type] More GEP API migrations
Modified:
polly/trunk/include/polly/CodeGen/LoopGenerators.h
polly/trunk/lib/CodeGen/LoopGenerators.cpp
Modified: polly/trunk/include/polly/CodeGen/LoopGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/LoopGenerators.h?rev=234131&r1=234130&r2=234131&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/LoopGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/LoopGenerators.h Sun Apr 5 17:51:12 2015
@@ -181,7 +181,7 @@ private:
/// @param Values The values which should be stored in the struct.
///
/// @return The created struct.
- Value *storeValuesIntoStruct(SetVector<Value *> &Values);
+ AllocaInst *storeValuesIntoStruct(SetVector<Value *> &Values);
/// @brief Extract all values from the @p Struct and construct the mapping.
///
@@ -189,8 +189,8 @@ private:
/// @param Struct The struct holding all the values in @p Values.
/// @param VMap A map to associate every element of @p Values with the
/// new llvm value loaded from the @p Struct.
- void extractValuesFromStruct(SetVector<Value *> Values, Value *Struct,
- ValueToValueMapTy &VMap);
+ void extractValuesFromStruct(SetVector<Value *> Values, Type *Ty,
+ Value *Struct, ValueToValueMapTy &VMap);
/// @brief Create the definition of the parallel subfunction.
Function *createSubFnDefinition();
@@ -206,7 +206,7 @@ private:
/// @param SubFn The newly created subfunction is returned here.
///
/// @return The newly created induction variable.
- Value *createSubFn(Value *Stride, Value *Struct,
+ Value *createSubFn(Value *Stride, AllocaInst *Struct,
SetVector<Value *> UsedValues, ValueToValueMapTy &VMap,
Function **SubFn);
};
Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.cpp?rev=234131&r1=234130&r2=234131&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Sun Apr 5 17:51:12 2015
@@ -147,18 +147,16 @@ Value *polly::createLoop(Value *LB, Valu
Value *ParallelLoopGenerator::createParallelLoop(
Value *LB, Value *UB, Value *Stride, SetVector<Value *> &UsedValues,
ValueToValueMapTy &Map, BasicBlock::iterator *LoopBody) {
- Value *Struct, *IV, *SubFnParam;
Function *SubFn;
- Struct = storeValuesIntoStruct(UsedValues);
-
+ AllocaInst *Struct = storeValuesIntoStruct(UsedValues);
BasicBlock::iterator BeforeLoop = Builder.GetInsertPoint();
- IV = createSubFn(Stride, Struct, UsedValues, Map, &SubFn);
+ Value *IV = createSubFn(Stride, Struct, UsedValues, Map, &SubFn);
*LoopBody = Builder.GetInsertPoint();
Builder.SetInsertPoint(BeforeLoop);
- SubFnParam = Builder.CreateBitCast(Struct, Builder.getInt8PtrTy(),
- "polly.par.userContext");
+ Value *SubFnParam = Builder.CreateBitCast(Struct, Builder.getInt8PtrTy(),
+ "polly.par.userContext");
// Add one as the upper bound provided by openmp is a < comparison
// whereas the codegenForSequential function creates a <= comparison.
@@ -272,7 +270,7 @@ Function *ParallelLoopGenerator::createS
return SubFn;
}
-Value *
+AllocaInst *
ParallelLoopGenerator::storeValuesIntoStruct(SetVector<Value *> &Values) {
SmallVector<Type *, 8> Members;
@@ -285,14 +283,14 @@ ParallelLoopGenerator::storeValuesIntoSt
BasicBlock &EntryBB = Builder.GetInsertBlock()->getParent()->getEntryBlock();
Instruction *IP = EntryBB.getFirstInsertionPt();
StructType *Ty = StructType::get(Builder.getContext(), Members);
- Value *Struct = new AllocaInst(Ty, 0, "polly.par.userContext", IP);
+ AllocaInst *Struct = new AllocaInst(Ty, 0, "polly.par.userContext", IP);
// Mark the start of the lifetime for the parameter struct.
ConstantInt *SizeOf = Builder.getInt64(DL.getTypeAllocSize(Ty));
Builder.CreateLifetimeStart(Struct, SizeOf);
for (unsigned i = 0; i < Values.size(); i++) {
- Value *Address = Builder.CreateStructGEP(Struct, i);
+ Value *Address = Builder.CreateStructGEP(Ty, Struct, i);
Builder.CreateStore(Values[i], Address);
}
@@ -300,15 +298,16 @@ ParallelLoopGenerator::storeValuesIntoSt
}
void ParallelLoopGenerator::extractValuesFromStruct(
- SetVector<Value *> OldValues, Value *Struct, ValueToValueMapTy &Map) {
+ SetVector<Value *> OldValues, Type *Ty, Value *Struct,
+ ValueToValueMapTy &Map) {
for (unsigned i = 0; i < OldValues.size(); i++) {
- Value *Address = Builder.CreateStructGEP(Struct, i);
+ Value *Address = Builder.CreateStructGEP(Ty, Struct, i);
Value *NewValue = Builder.CreateLoad(Address);
Map[OldValues[i]] = NewValue;
}
}
-Value *ParallelLoopGenerator::createSubFn(Value *Stride, Value *StructData,
+Value *ParallelLoopGenerator::createSubFn(Value *Stride, AllocaInst *StructData,
SetVector<Value *> Data,
ValueToValueMapTy &Map,
Function **SubFnPtr) {
@@ -338,7 +337,8 @@ Value *ParallelLoopGenerator::createSubF
UserContext = Builder.CreateBitCast(SubFn->arg_begin(), StructData->getType(),
"polly.par.userContext");
- extractValuesFromStruct(Data, UserContext, Map);
+ extractValuesFromStruct(Data, StructData->getAllocatedType(), UserContext,
+ Map);
Builder.CreateBr(CheckNextBB);
// Add code to check if another set of iterations will be executed.
More information about the llvm-commits
mailing list