From c67668ff21e3e8b6098668bc1f696a9f2cec6631 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 24 Jan 2016 19:32:52 +0000 Subject: [PATCH] [LoopSimplify] Reuse changeToUnreachable Use existing functionality provided in changeToUnreachable instead of reinventing it in LoopSimplify. No functionality change is intended. llvm-svn: 258663 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 1fa469595d16..f17b26c40e37 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -489,14 +489,9 @@ ReprocessLoop: DEBUG(dbgs() << "LoopSimplify: Deleting edge from dead predecessor " << P->getName() << "\n"); - // Inform each successor of each dead pred. - for (succ_iterator SI = succ_begin(P), SE = succ_end(P); SI != SE; ++SI) - (*SI)->removePredecessor(P); // Zap the dead pred's terminator and replace it with unreachable. TerminatorInst *TI = P->getTerminator(); - TI->replaceAllUsesWith(UndefValue::get(TI->getType())); - P->getTerminator()->eraseFromParent(); - new UnreachableInst(P->getContext(), P); + changeToUnreachable(TI, /*UseLLVMTrap=*/false); Changed = true; } }