[NFC] Instruction: introduce replaceSuccessorWith() function, use it
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 5 May 2019 18:59:22 +0000 (18:59 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 5 May 2019 18:59:22 +0000 (18:59 +0000)
commit7ad5d14f3a2c916277e25737de9ff3f605131d1a
treec497b184991fcdbe59583f27ad4847fe614f25f4
parente5be660e25774e4a769be52a9b7817a1917b7ff7
[NFC] Instruction: introduce replaceSuccessorWith() function, use it

Summary:
There is `Instruction::getNumSuccessors()`, `Instruction::getSuccessor()`
and `Instruction::setSuccessor()`, but no function to replace every
specified `BasicBlock*` successor with some other specified `BasicBlock*`.
I've found one place where it should clearly be used.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61010

llvm-svn: 359994
llvm/include/llvm/IR/Instruction.h
llvm/lib/IR/Instruction.cpp
llvm/lib/Transforms/Utils/LoopSimplify.cpp