Fix IVUsers to avoid assuming that the loop has a unique backedge.

llvm-svn: 86161
This commit is contained in:
Dan Gohman 2009-11-05 19:41:37 +00:00
parent 885c46e387
commit 2267f8aa72
1 changed files with 2 additions and 0 deletions

View File

@ -151,6 +151,8 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV,
if (L->contains(User->getParent())) return false;
BasicBlock *LatchBlock = L->getLoopLatch();
if (!LatchBlock)
return false;
// Ok, the user is outside of the loop. If it is dominated by the latch
// block, use the post-inc value.