summaryrefslogtreecommitdiffstats
path: root/polly/lib
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2015-11-26 12:26:06 +0000
committerMichael Kruse <llvm@meinersbur.de>2015-11-26 12:26:06 +0000
commitcba170e4d0c7b82c29e66a45a4a9db7617b1ee44 (patch)
tree7ede6471f0ee08f2d1601476766f8f72fee325e4 /polly/lib
parentfbb6a237baf4294b230c0881d0f882cc3b971f3c (diff)
downloadbcm5719-llvm-cba170e4d0c7b82c29e66a45a4a9db7617b1ee44.tar.gz
bcm5719-llvm-cba170e4d0c7b82c29e66a45a4a9db7617b1ee44.zip
Introduce origin/kind for exit PHI node accesses
Previously, accesses that originate from PHI nodes in the exit block were registered as SCALAR. In some context they are treated as scalars, but it makes a difference in others. We used to check whether the AccessInstruction is a terminator to differentiate the cases. This patch introduces an MemoryAccess origin EXIT_PHI and a ScopArrayInfo kind KIND_EXIT_PHI to make this case more explicit. No behavioural change intended. Differential Revision: http://reviews.llvm.org/D14688 llvm-svn: 254149
Diffstat (limited to 'polly/lib')
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp4
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 33c5cdf165a..5f902029305 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -883,6 +883,8 @@ void ScopStmt::buildAccessRelations() {
ScopArrayInfo::ARRAYKIND Ty;
if (Access->isPHI())
Ty = ScopArrayInfo::KIND_PHI;
+ else if (Access->isExitPHI())
+ Ty = ScopArrayInfo::KIND_EXIT_PHI;
else if (Access->isImplicit())
Ty = ScopArrayInfo::KIND_SCALAR;
else
@@ -3932,7 +3934,7 @@ void ScopInfo::addPHIWriteAccess(PHINode *PHI, BasicBlock *IncomingBlock,
addMemoryAccess(IncomingBlock, IncomingBlock->getTerminator(),
MemoryAccess::MUST_WRITE, PHI, 1, true, IncomingValue,
ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(),
- IsExitBlock ? MemoryAccess::SCALAR : MemoryAccess::PHI);
+ IsExitBlock ? MemoryAccess::EXIT_PHI : MemoryAccess::PHI);
}
void ScopInfo::addPHIReadAccess(PHINode *PHI) {
addMemoryAccess(PHI->getParent(), PHI, MemoryAccess::READ, PHI, 1, true, PHI,
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 962cc380244..67d2e2260c9 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -1201,7 +1201,7 @@ void RegionGenerator::generateScalarStores(ScopStmt &Stmt, LoopToScevMapT &LTS,
ValueMapT *LocalBBMap = &BBMap;
// Implicit writes induced by PHIs must be written in the incoming blocks.
- if (isa<TerminatorInst>(ScalarInst)) {
+ if (MA->isPHI() || MA->isExitPHI()) {
BasicBlock *ExitingBB = ScalarInst->getParent();
BasicBlock *ExitingBBCopy = BlockMap[ExitingBB];
Builder.SetInsertPoint(ExitingBBCopy->getTerminator());
@@ -1217,7 +1217,7 @@ void RegionGenerator::generateScalarStores(ScopStmt &Stmt, LoopToScevMapT &LTS,
Builder.CreateStore(Val, Address);
// Restore the insertion point if necessary.
- if (isa<TerminatorInst>(ScalarInst))
+ if (MA->isPHI() || MA->isExitPHI())
Builder.SetInsertPoint(SavedInsertBB, SavedInsertionPoint);
}
}
OpenPOWER on IntegriCloud