diff options
author | Michael Kruse <llvm@meinersbur.de> | 2015-08-11 14:47:37 +0000 |
---|---|---|
committer | Michael Kruse <llvm@meinersbur.de> | 2015-08-11 14:47:37 +0000 |
commit | 9c483c5834eeb9d560a0526286784327461a6792 (patch) | |
tree | e670e219bf78f33d0c25069131faf63cc94586f8 /polly/lib/CodeGen/CodeGeneration.cpp | |
parent | 25b2601bcad890725ac2ea9b18552e478493e8fb (diff) | |
download | bcm5719-llvm-9c483c5834eeb9d560a0526286784327461a6792.tar.gz bcm5719-llvm-9c483c5834eeb9d560a0526286784327461a6792.zip |
Assign regions to all BBs from CodeGeneration
In order to have a valid region analysis, we assign all newly created blocks to the parent of the scop's region. This is correct for any pre-existing regions (including the scop's region and its parent), but does not discover any region inside the generated code. For Polly this is not necessary because we do not want to re-run Polly on its own generated code anyway.
Reviewers: grosser
Part of Differential Revision: http://reviews.llvm.org/D11867
llvm-svn: 244608
Diffstat (limited to 'polly/lib/CodeGen/CodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 5f50ab40e9e..1795cadad58 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -92,6 +92,18 @@ public: return true; } + // CodeGeneration adds a lot of BBs without updating the RegionInfo + // We make all created BBs belong to the scop's parent region without any + // nested structure to keep the RegionInfo verifier happy. + void fixRegionInfo(Function *F, Region *ParentRegion) { + for (BasicBlock &BB : *F) { + if (RI->getRegionFor(&BB)) + continue; + + RI->setRegionFor(&BB, ParentRegion); + } + } + bool runOnScop(Scop &S) override { AI = &getAnalysis<IslAstInfo>(); @@ -136,6 +148,7 @@ public: NodeBuilder.create(AstRoot); NodeBuilder.finalizeSCoP(S); + fixRegionInfo(EnteringBB->getParent(), R->getParent()); assert(!verifyGeneratedFunction(S, *EnteringBB->getParent()) && "Verification of generated function failed"); |