From dbb0ef8e9440a3d5c105eb9f3de05cfd67c6f31c Mon Sep 17 00:00:00 2001 From: Andreas Simbuerger Date: Tue, 27 Jun 2017 11:33:22 +0000 Subject: [PATCH] [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 --- polly/lib/CodeGen/CodeGeneration.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 41ee788402fd..fc2bcf056fb4 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -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()); }