diff options
-rw-r--r-- | polly/lib/CodeGeneration.cpp | 18 | ||||
-rw-r--r-- | polly/test/CodeGen/OpenMP/extract_memref.ll | 8 | ||||
-rw-r--r-- | polly/test/CodeGen/OpenMP/simple_nested_loop.ll | 14 | ||||
-rw-r--r-- | polly/test/CodeGen/OpenMP/structnames.ll | 5 |
4 files changed, 24 insertions, 21 deletions
diff --git a/polly/lib/CodeGeneration.cpp b/polly/lib/CodeGeneration.cpp index 606f746092e..87f16651c13 100644 --- a/polly/lib/CodeGeneration.cpp +++ b/polly/lib/CodeGeneration.cpp @@ -823,7 +823,7 @@ public: Function *F = Builder.GetInsertBlock()->getParent(); const std::string &Name = F->getNameStr() + ".omp_subfn"; - std::vector<const Type*> Arguments(1, Builder.getInt8PtrTy()); + std::vector<Type*> Arguments(1, Builder.getInt8PtrTy()); FunctionType *FT = FunctionType::get(Builder.getVoidTy(), Arguments, false); Function *FN = Function::Create(FT, Function::InternalLinkage, Name, M); // Do not run any polly pass on the new function. @@ -840,18 +840,14 @@ public: /// Create the subfunction structure and add the values from the list. Value *addValuesToOpenMPStruct(SetVector<Value*> OMPDataVals, Function *SubFunction) { - Module *M = Builder.GetInsertBlock()->getParent()->getParent(); - std::vector<const Type*> structMembers; + std::vector<Type*> structMembers; // Create the structure. for (unsigned i = 0; i < OMPDataVals.size(); i++) structMembers.push_back(OMPDataVals[i]->getType()); - const std::string &Name = SubFunction->getNameStr() + ".omp.userContext"; StructType *structTy = StructType::get(Builder.getContext(), structMembers); - M->addTypeName(Name, structTy); - // Store the values into the structure. Value *structData = Builder.CreateAlloca(structTy, 0, "omp.userContext"); for (unsigned i = 0; i < OMPDataVals.size(); i++) { @@ -1275,7 +1271,7 @@ class CodeGeneration : public ScopPass { { Module *M = Builder.GetInsertBlock()->getParent()->getParent(); LLVMContext &Context = Builder.getContext(); - const IntegerType *intPtrTy = TD->getIntPtrType(Context); + IntegerType *intPtrTy = TD->getIntPtrType(Context); if (!M->getFunction("GOMP_parallel_end")) { FunctionType *FT = FunctionType::get(Type::getVoidTy(Context), false); @@ -1284,12 +1280,12 @@ class CodeGeneration : public ScopPass { if (!M->getFunction("GOMP_parallel_loop_runtime_start")) { // Type of first argument. - std::vector<const Type*> Arguments(1, Builder.getInt8PtrTy()); + std::vector<Type*> Arguments(1, Builder.getInt8PtrTy()); FunctionType *FnArgTy = FunctionType::get(Builder.getVoidTy(), Arguments, false); PointerType *FnPtrTy = PointerType::getUnqual(FnArgTy); - std::vector<const Type*> args; + std::vector<Type*> args; args.push_back(FnPtrTy); args.push_back(Builder.getInt8PtrTy()); args.push_back(Builder.getInt32Ty()); @@ -1305,7 +1301,7 @@ class CodeGeneration : public ScopPass { if (!M->getFunction("GOMP_loop_runtime_next")) { PointerType *intLongPtrTy = PointerType::getUnqual(intPtrTy); - std::vector<const Type*> args; + std::vector<Type*> args; args.push_back(intLongPtrTy); args.push_back(intLongPtrTy); @@ -1316,7 +1312,7 @@ class CodeGeneration : public ScopPass { if (!M->getFunction("GOMP_loop_end_nowait")) { FunctionType *FT = FunctionType::get(Builder.getVoidTy(), - std::vector<const Type*>(), false); + std::vector<Type*>(), false); Function::Create(FT, Function::ExternalLinkage, "GOMP_loop_end_nowait", M); } diff --git a/polly/test/CodeGen/OpenMP/extract_memref.ll b/polly/test/CodeGen/OpenMP/extract_memref.ll index 797ea0f0490..c5993b44038 100644 --- a/polly/test/CodeGen/OpenMP/extract_memref.ll +++ b/polly/test/CodeGen/OpenMP/extract_memref.ll @@ -31,7 +31,9 @@ entry: call void @foo() ret i32 0 } -; CHECK: store [10 x float]* %A, [10 x float]** -; CHECK: getelementptr inbounds %foo.omp_subfn.omp.userContext* %omp.userContext1 +; CHECK: getelementptr inbounds { [10 x float]* }* %omp.userContext, i32 0, i32 0 +; CHECK: store [10 x float]* %A, [10 x float]** %0 +; CHECK: %omp_data = bitcast { [10 x float]* }* %omp.userContext to i8* +; CHECK: inbounds { [10 x float]* }* %omp.userContext1, i32 0, i32 0 ; CHECK: load [10 x float]** -; CHECK: getelementptr inbounds [10 x float]* + diff --git a/polly/test/CodeGen/OpenMP/simple_nested_loop.ll b/polly/test/CodeGen/OpenMP/simple_nested_loop.ll index d3f27055817..652fa0f9214 100644 --- a/polly/test/CodeGen/OpenMP/simple_nested_loop.ll +++ b/polly/test/CodeGen/OpenMP/simple_nested_loop.ll @@ -55,9 +55,13 @@ entry: declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind -; CHECK: %omp.userContext = alloca %loop_openmp.omp_subfn.omp.userContext -; CHECK: getelementptr inbounds %loop_openmp.omp_subfn.omp.userContext* %omp.userContext -; CHECK: %omp_data = bitcast %loop_openmp.omp_subfn.omp.userContext* %omp.userContext to i8* -; CHECK: @GOMP_parallel_loop_runtime_start(void (i8*)* @loop_openmp.omp_subfn, i8* %omp_data +; CHECK: %omp.userContext = alloca { i32, [10 x double]* } +; CHECK: getelementptr inbounds { i32, [10 x double]* }* %omp.userContext, i32 0, i32 0 +; CHECK: store i32 %polly.loopiv, i32* %1 +; CHECK: getelementptr inbounds { i32, [10 x double]* }* %omp.userContext, i32 0, i32 1 +; CHECK: store [10 x double]* @A, [10 x double]** %2 +; CHECK: %omp_data = bitcast { i32, [10 x double]* }* %omp.userContext to i8* +; CHECK: call void @GOMP_parallel_loop_runtime_start(void (i8*)* @loop_openmp.omp_subfn, i8* %omp_data, i32 0, i32 0, i32 10, i32 1) ; CHECK: call void @loop_openmp.omp_subfn(i8* %omp_data) -; CHECK: %omp.userContext1 = bitcast i8* %omp.userContext to %loop_openmp.omp_subfn.omp.userContext* +; CHECK: call void @GOMP_parallel_end() + diff --git a/polly/test/CodeGen/OpenMP/structnames.ll b/polly/test/CodeGen/OpenMP/structnames.ll index 62170b7abce..5ce7132801d 100644 --- a/polly/test/CodeGen/OpenMP/structnames.ll +++ b/polly/test/CodeGen/OpenMP/structnames.ll @@ -72,5 +72,6 @@ entry: declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind -; CHECK: loop1_openmp.omp_subfn.omp.userContext -; CHECK: loop1_openmp.omp_subfn1.omp.userContext +; CHECK: %omp.userContext = alloca { [5 x float]*, [5 x float]* } +; CHECK: %omp.userContext1 = alloca { i32, [5 x float]*, [5 x float]* } + |