summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2016-04-01 11:25:47 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2016-04-01 11:25:47 +0000
commit6ba927148dfb5f998c72636fb4a08bf66760d23d (patch)
tree875e2a4e44babdd02ed62d34a8870663fb9e2afe /polly/lib/CodeGen
parentb345e0d15c5422bb4049092211f44015ee45d1bc (diff)
downloadbcm5719-llvm-6ba927148dfb5f998c72636fb4a08bf66760d23d.tar.gz
bcm5719-llvm-6ba927148dfb5f998c72636fb4a08bf66760d23d.zip
[FIX] Adjust the insert point for non-affine region PHIs
If a non-affine region PHI is generated we should not move the insert point prior to the synthezised value in the same block as we might split that block at the insert point later on. Only if the incoming value should be placed in a different block we should change the insertion point. llvm-svn: 265132
Diffstat (limited to 'polly/lib/CodeGen')
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index e643ada9eed..e980d375a17 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -1365,11 +1365,14 @@ void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, const PHINode *PHI,
Value *Op = PHI->getIncomingValueForBlock(IncomingBB);
- BasicBlock *OldBlock = Builder.GetInsertBlock();
- auto OldIP = Builder.GetInsertPoint();
- Builder.SetInsertPoint(BBCopy->getTerminator());
+ // If the current insert block is different from the PHIs incoming block
+ // change it, otherwise do not.
+ auto IP = Builder.GetInsertPoint();
+ if (IP->getParent() != BBCopy)
+ Builder.SetInsertPoint(BBCopy->getTerminator());
OpCopy = getNewValue(Stmt, Op, BBCopyMap, LTS, getLoopForStmt(Stmt));
- Builder.SetInsertPoint(OldBlock, OldIP);
+ if (IP->getParent() != BBCopy)
+ Builder.SetInsertPoint(&*IP);
} else {
if (PHICopy->getBasicBlockIndex(BBCopy) >= 0)
OpenPOWER on IntegriCloud