diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 4a98b3fd3550..8578faf76f68 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -708,10 +708,9 @@ static bool BlockDominatesAny(BasicBlock* A, const std::vector& B, void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB, std::vector &PredBlocks) { assert(!PredBlocks.empty() && "No predblocks??"); - assert(succ_begin(NewBB) != succ_end(NewBB) && - ++succ_begin(NewBB) == succ_end(NewBB) && - "NewBB should have a single successor!"); - BasicBlock *NewBBSucc = *succ_begin(NewBB); + assert(NewBB->getTerminator()->getNumSuccessors() == 1 + && "NewBB should have a single successor!"); + BasicBlock *NewBBSucc = NewBB->getTerminator()->getSuccessor(0); DominatorTree &DT = getAnalysis(); // The newly inserted basic block will dominate existing basic blocks iff the