[PATCH 01/11] Do not allow SCoP contains the entry block of function, and do not split entry block in IndependentBlocks pass.

0 views
Skip to first unread message

ether zhhb

unread,
Apr 5, 2011, 9:37:33 PM4/5/11
to polly-commits
hi,

The entry block spliting code exists in CodePreperation and
IndependentBlock at the same time, so this patch make ScopDetection
requires a scop do not contains the entry block of the function and
the remove the entry block spliting code in IndependentBlocks pass.

This patch will reduce Polly's coverage without running
-polly-prepare, but remove some redundant code.

This patch passed the pass the regression tests as -polly-prepare
already contains in the default testing option.

since this likely will not break anything else, i am going to push it out.

best regards
ether

---
lib/Analysis/ScopDetection.cpp | 8 ++++++++
lib/IndependentBlocks.cpp | 15 +--------------
2 files changed, 9 insertions(+), 14 deletions(-)

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');

--
1.7.3.3

Reply all
Reply to author
Forward
0 new messages