[NFC][CodeGen] Use the ExitBlock explicitly.

Before we would 'guess' the correct location for the MergeBlock
that got introduced when executing a Scop conditionally. This
implicitly depends on the situation that at this point during
CodeGen there will be nothing between polly.start and polly.exiting.

With this commit we explicitly state that we want the block that
directly follows polly.exiting.

llvm-svn: 306398
This commit is contained in:
Andreas Simbuerger 2017-06-27 11:33:22 +00:00
parent cdda23eb7c
commit dbb0ef8e94
1 changed files with 2 additions and 4 deletions

View File

@ -178,6 +178,7 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
BBPair StartExitBlocks =
executeScopConditionally(S, Builder.getTrue(), DT, RI, LI);
BasicBlock *StartBlock = std::get<0>(StartExitBlocks);
BasicBlock *ExitBlock = std::get<1>(StartExitBlocks);
removeLifetimeMarkers(R);
auto *SplitBlock = StartBlock->getSinglePredecessor();
@ -194,10 +195,7 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
P.initialize();
P.insertRegionStart(SplitBlock->getTerminator());
BasicBlock *MergeBlock = SplitBlock->getTerminator()
->getSuccessor(0)
->getUniqueSuccessor()
->getUniqueSuccessor();
BasicBlock *MergeBlock = ExitBlock->getUniqueSuccessor();
P.insertRegionEnd(MergeBlock->getTerminator());
}