Fix IVUsers to avoid assuming that the loop has a unique backedge.
authorDan Gohman <gohman@apple.com>
Thu, 5 Nov 2009 19:41:37 +0000 (19:41 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 5 Nov 2009 19:41:37 +0000 (19:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86161 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/IVUsers.cpp

index 543e017fc9dd7907dead8f99680a39de846561f3..20b69f2a7ca2c34edad230e4bdada12741b5e058 100644 (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.