summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/CodeGeneration.cpp
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2015-08-11 14:39:21 +0000
committerMichael Kruse <llvm@meinersbur.de>2015-08-11 14:39:21 +0000
commit22370884c4d536b56e4e7a42f4a4cb962c1cfe14 (patch)
tree9926692a48ca313af03a0624f5798fc997e028ae /polly/lib/CodeGen/CodeGeneration.cpp
parentc454f07eb1997820f0a3203350c523b5d697bf34 (diff)
downloadbcm5719-llvm-22370884c4d536b56e4e7a42f4a4cb962c1cfe14.tar.gz
bcm5719-llvm-22370884c4d536b56e4e7a42f4a4cb962c1cfe14.zip
Revise the simplification of regions
The previous code had several problems: For newly created BasicBlocks it did not (always) call RegionInfo::setRegionFor in order to update its analysis. At the moment RegionInfo does not verify its BBMap, but will in the future. This is fixed by determining the region new BBs belong to and set it accordingly. The new executeScopConditionally() requires accurate getRegionFor information. Which block is created by SplitEdge depends on the incoming and outgoing edges of the blocks it connects, which makes handling its output more difficult than it needs to be. Especially for finding which block has been created an to assign a region to it for the setRegionFor problem above. This patch uses an implementation for splitEdge that always creates a block between the predecessor and successor. simplifyRegion has also been simplified by using SplitBlockPredecessors instead of SplitEdge. Isolating the entries and exits have been refectored into individual functions. Previously simplifyRegion did more than just ensuring that there is only one entering and one exiting edge. It ensured that the entering block had no other outgoing edge which was necessary for executeScopConditionally(). Now the latter uses the alternative splitEdge implementation which can handle this situation so simplifyRegion really only needs to simplify the region. Also, executeScopConditionally assumed that there can be no PHI nodes in blocks with one incoming edge. This is wrong and LCSSA deliberately produces such edges. However, previous passes ensured that there can be no such PHIs in exit nodes, but which will no longer hold in the future. The new code that the property that it preserves the identity of region block (the property that the memory address of the BasicBlock containing the instructions remains the same; new blocks only contain PHI nodes and a terminator), especially the entry block. As a result, there is no need to update the reference to the BasicBlock of ScopStmt that contain its instructions because they have been moved to other basic blocks. Reviewers: grosser Part of Differential Revision: http://reviews.llvm.org/D11867 llvm-svn: 244606
Diffstat (limited to 'polly/lib/CodeGen/CodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/CodeGeneration.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index aef65613f16..5f50ab40e9e 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -53,6 +53,7 @@ public:
IslAstInfo *AI;
DominatorTree *DT;
ScalarEvolution *SE;
+ RegionInfo *RI;
///}
/// @brief The loop annotator to generate llvm.loop metadata.
@@ -103,13 +104,16 @@ public:
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
SE = &getAnalysis<ScalarEvolution>();
DL = &S.getRegion().getEntry()->getParent()->getParent()->getDataLayout();
-
- assert(!S.getRegion().isTopLevelRegion() &&
- "Top level regions are not supported");
+ RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
+ Region *R = &S.getRegion();
+ assert(!R->isTopLevelRegion() && "Top level regions are not supported");
Annotator.buildAliasScopes(S);
- BasicBlock *EnteringBB = simplifyRegion(&S, this);
+ simplifyRegion(R, DT, LI, RI);
+ assert(R->isSimple());
+ BasicBlock *EnteringBB = S.getRegion().getEnteringBlock();
+ assert(EnteringBB);
PollyIRBuilder Builder = createPollyIRBuilder(EnteringBB, Annotator);
IslNodeBuilder NodeBuilder(Builder, Annotator, this, *DL, *LI, *SE, *DT, S);
OpenPOWER on IntegriCloud