[polly] r244608 - Assign regions to all BBs from CodeGeneration
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 11 07:47:38 PDT 2015
Author: meinersbur
Date: Tue Aug 11 09:47:37 2015
New Revision: 244608
URL: http://llvm.org/viewvc/llvm-project?rev=244608&view=rev
Log:
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
Modified:
polly/trunk/lib/CodeGen/CodeGeneration.cpp
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=244608&r1=244607&r2=244608&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Tue Aug 11 09:47:37 2015
@@ -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");
More information about the llvm-commits
mailing list