summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/IslNodeBuilder.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-09-26 20:57:59 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2015-09-26 20:57:59 +0000
commitfb19dd694c24230f2c34f440f87e9d2c8bb2e812 (patch)
treea6884c6448553ff6b9516dc81bedafa927d0f5b8 /polly/lib/CodeGen/IslNodeBuilder.cpp
parent8518eb54f3aa48130307563a2bf7f23493e63fca (diff)
downloadbcm5719-llvm-fb19dd694c24230f2c34f440f87e9d2c8bb2e812.tar.gz
bcm5719-llvm-fb19dd694c24230f2c34f440f87e9d2c8bb2e812.zip
Create parallel code in a separate block
This commit basically reverts r246427 but still solves the issue tackled by that commit. Instead of emitting initialization code in the beginning of the start block we now generate parallel code in its own block and thereby guarantee separation. This is necessary as we cannot generate code for hoisted loads prior to the start block but it still needs to be placed prior to everything else. llvm-svn: 248674
Diffstat (limited to 'polly/lib/CodeGen/IslNodeBuilder.cpp')
-rw-r--r--polly/lib/CodeGen/IslNodeBuilder.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index 85c92402dcd..1574e6167f0 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -534,6 +534,14 @@ void IslNodeBuilder::createForParallel(__isl_take isl_ast_node *For) {
Value *IV;
CmpInst::Predicate Predicate;
+ // The preamble of parallel code interacts different than normal code with
+ // e.g., scalar initialization. Therefore, we ensure the parallel code is
+ // separated from the last basic block.
+ BasicBlock *ParBB =
+ SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), &DT, &LI);
+ ParBB->setName("polly.parallel.for");
+ Builder.SetInsertPoint(ParBB->begin());
+
Body = isl_ast_node_for_get_body(For);
Init = isl_ast_node_for_get_init(For);
Inc = isl_ast_node_for_get_inc(For);
OpenPOWER on IntegriCloud