diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-05-05 18:59:30 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-05-05 18:59:30 +0000 |
commit | e3b1d82b5302102c17ea465ca609cde2a49da314 (patch) | |
tree | 3bdbf877cf939a560ed3b6891f3826bd38f0d159 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 7ad5d14f3a2c916277e25737de9ff3f605131d1a (diff) | |
download | bcm5719-llvm-e3b1d82b5302102c17ea465ca609cde2a49da314.tar.gz bcm5719-llvm-e3b1d82b5302102c17ea465ca609cde2a49da314.zip |
[NFC] PHINode: introduce replaceIncomingBlockWith() function, use it
Summary:
There is `PHINode::getBasicBlockIndex()`, `PHINode::setIncomingBlock()`
and `PHINode::getNumOperands()`, but no function to replace every
specified `BasicBlock*` predecessor with some other specified `BasicBlock*`.
Clearly, there are a lot of places that could use that functionality.
Reviewers: chandlerc, craig.topper, spatel, danielcdh
Reviewed By: craig.topper
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61011
llvm-svn: 359995
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 45afaf20c59..aa57748ffa7 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -7221,11 +7221,8 @@ bool CodeGenPrepare::splitBranchCondition(Function &F, bool &ModifiedDT) { std::swap(TBB, FBB); // Replace the old BB with the new BB. - for (PHINode &PN : TBB->phis()) { - int i; - while ((i = PN.getBasicBlockIndex(&BB)) >= 0) - PN.setIncomingBlock(i, TmpBB); - } + for (PHINode &PN : TBB->phis()) + PN.replaceIncomingBlockWith(&BB, TmpBB); // Add another incoming edge form the new BB. for (PHINode &PN : FBB->phis()) { |