[FIX] Check loop latches for valid control too.

This patch cannot be tested on its own as the isValidCFG currently
  hides the fact that control is actually non-affine with
  over-approximation. This will be corrected in the next patch and a
  test for non-affine latches will be added.

llvm-svn: 249272
This commit is contained in:
Johannes Doerfert 2015-10-04 14:53:18 +00:00
parent 8dba07770f
commit 30ffb6fcb6
1 changed files with 7 additions and 6 deletions

View File

@ -729,12 +729,13 @@ bool ScopDetection::isValidInstruction(Instruction &Inst,
bool ScopDetection::canUseISLTripCount(Loop *L,
DetectionContext &Context) const {
// Ensure the loop has valid exiting blocks, otherwise we need to
// overapproximate it as a boxed loop.
SmallVector<BasicBlock *, 4> ExitingBlocks;
L->getExitingBlocks(ExitingBlocks);
for (BasicBlock *ExitingBB : ExitingBlocks) {
if (!isValidCFG(*ExitingBB, Context))
// Ensure the loop has valid exiting blocks as well as latches, otherwise we
// need to overapproximate it as a boxed loop.
SmallVector<BasicBlock *, 4> LoopControlBlocks;
L->getLoopLatches(LoopControlBlocks);
L->getExitingBlocks(LoopControlBlocks);
for (BasicBlock *ControlBB : LoopControlBlocks) {
if (!isValidCFG(*ControlBB, Context))
return false;
}