[NFC] BasicBlock: refactor changePhiUses() out of replacePhiUsesWith(), use it

Summary:
It is a common thing to loop over every `PHINode` in some `BasicBlock`
and change old `BasicBlock` incoming block to a new `BasicBlock` incoming block.
`replaceSuccessorsPhiUsesWith()` already had code to do that,
it just wasn't a function.
So outline it into a new function, and use it.

Reviewers: chandlerc, craig.topper, spatel, danielcdh

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359996 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roman Lebedev
2019-05-05 18:59:39 +00:00
parent 14d59d23ed
commit fb75d57329
5 changed files with 32 additions and 37 deletions
+1 -2
View File
@@ -7221,8 +7221,7 @@ bool CodeGenPrepare::splitBranchCondition(Function &F, bool &ModifiedDT) {
std::swap(TBB, FBB);
// Replace the old BB with the new BB.
for (PHINode &PN : TBB->phis())
PN.replaceIncomingBlockWith(&BB, TmpBB);
TBB->replacePhiUsesWith(&BB, TmpBB);
// Add another incoming edge form the new BB.
for (PHINode &PN : FBB->phis()) {