[polly] r179158 - Codegen: Replace region exit and entries recursively

Tobias Grosser grosser at fim.uni-passau.de
Tue Apr 9 23:55:21 PDT 2013


Author: grosser
Date: Wed Apr 10 01:55:20 2013
New Revision: 179158

URL: http://llvm.org/viewvc/llvm-project?rev=179158&view=rev
Log:
Codegen: Replace region exit and entries recursively

During code generation we split the original entry and exit basic blocks
of the scop to make room for the newly generated code. To keep the region tree
up to date, we need to update the region tree. This patch ensures that not only
the region of the scop is updated, but also all child regions that share the
same entry or exit block.

We have now test case here, as the bug is only exposed by the subsequent commit.
The test cases of that commit also cover this bug.

Contributed-by: Star Tan <tanmx_star at yeah.net>

Modified:
    polly/trunk/lib/CodeGen/Utils.cpp

Modified: polly/trunk/lib/CodeGen/Utils.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Utils.cpp?rev=179158&r1=179157&r2=179158&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Utils.cpp (original)
+++ polly/trunk/lib/CodeGen/Utils.cpp Wed Apr 10 01:55:20 2013
@@ -46,7 +46,7 @@ BasicBlock *polly::executeScopConditiona
     SplitBlock = OldBlock;
     OldBlock->setName("polly.split");
     NewBlock->setName(OldName);
-    R.replaceEntry(NewBlock);
+    R.replaceEntryRecursive(NewBlock);
     RI.setRegionFor(NewBlock, &R);
   } else {
     RI.setRegionFor(NewBlock, R.getParent());
@@ -72,7 +72,8 @@ BasicBlock *polly::executeScopConditiona
     MergeBlock = SplitEdge(R.getExitingBlock(), R.getExit(), PassInfo);
     // SplitEdge will never split R.getExit(), as R.getExit() has more than
     // one predecessor. Hence, mergeBlock is always a newly generated block.
-    R.replaceExit(MergeBlock);
+    R.replaceExitRecursive(MergeBlock);
+    RI.setRegionFor(MergeBlock, &R);
   }
 
   Builder.CreateBr(MergeBlock);





More information about the llvm-commits mailing list