[COMMIT] Do not allow SCoP contains the entry block of function, and do not split

1 view
Skip to first unread message

ether

unread,
Apr 5, 2011, 9:39:05 PM4/5/11
to polly-...@googlegroups.com

commit 277c5275e07ae1cbccd93517781050d336bea63c
Author: ether <ethe...@gmail.com>
Date: Wed Apr 6 09:02:47 2011 +0800

Do not allow SCoP contains the entry block of function, and do not split
entry block in IndependentBlocks pass.

diff --git a/lib/Analysis/ScopDetection.cpp b/lib/Analysis/ScopDetection.cpp
index 8611ce5..389b490 100644
--- a/lib/Analysis/ScopDetection.cpp
+++ b/lib/Analysis/ScopDetection.cpp
@@ -563,6 +563,14 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const {
return false;
}

+ // SCoP can not contains the entry block of the function, because we need
+ // to insert alloca instruction there when translate scalar to array.
+ if (R.getEntry() == &(R.getEntry()->getParent()->getEntryBlock())) {
+ DEBUG(dbgs() << "Region containing entry block of function is invalid!\n");
+ STATSCOP(Other);
+ return false;
+ }
+
if (!allBlocksValid(Context))
return false;

diff --git a/lib/IndependentBlocks.cpp b/lib/IndependentBlocks.cpp
index ad453ca..9083c48 100644
--- a/lib/IndependentBlocks.cpp
+++ b/lib/IndependentBlocks.cpp
@@ -503,20 +503,7 @@ bool IndependentBlocks::runOnFunction(llvm::Function &F) {
SD = &getAnalysis<ScopDetection>();
SE = &getAnalysis<ScalarEvolution>();

- BasicBlock *EntryBlock = &F.getEntryBlock();
- Region *R = RI->getRegionFor(EntryBlock);
-
- while (!R->isTopLevelRegion()) {
- // If the entry block belong to any Scop, split it.
- if (SD->isMaxRegionInScop(*R)) {
- splitEntryBlockForAlloca(EntryBlock, this);
- break;
- }
-
- R = R->getParent();
- }
-
- AllocaBlock = EntryBlock;
+ AllocaBlock = &F.getEntryBlock();

DEBUG(dbgs() << "Run IndepBlock on " << F.getName() << '\n');

Reply all
Reply to author
Forward
0 new messages