summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-05-05 18:59:39 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-05-05 18:59:39 +0000
commit1a1b92217787842d06a1d9d68529763a11338a47 (patch)
tree21dc89c1be69f21baf8f5565e4a769606e7c948b /llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
parente3b1d82b5302102c17ea465ca609cde2a49da314 (diff)
downloadbcm5719-llvm-1a1b92217787842d06a1d9d68529763a11338a47.tar.gz
bcm5719-llvm-1a1b92217787842d06a1d9d68529763a11338a47.zip
[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 llvm-svn: 359996
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index 92e3e9a0496..64a97f86a21 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -1325,8 +1325,7 @@ LoopConstrainer::RewrittenRangeInfo LoopConstrainer::changeIterationSpaceEnd(
// The latch exit now has a branch from `RRI.ExitSelector' instead of
// `LS.Latch'. The PHI nodes need to be updated to reflect that.
- for (PHINode &PN : LS.LatchExit->phis())
- PN.replaceIncomingBlockWith(LS.Latch, RRI.ExitSelector);
+ LS.LatchExit->replacePhiUsesWith(LS.Latch, RRI.ExitSelector);
return RRI;
}
@@ -1349,8 +1348,7 @@ BasicBlock *LoopConstrainer::createPreheader(const LoopStructure &LS,
BasicBlock *Preheader = BasicBlock::Create(Ctx, Tag, &F, LS.Header);
BranchInst::Create(LS.Header, Preheader);
- for (PHINode &PN : LS.Header->phis())
- PN.replaceIncomingBlockWith(OldPreheader, Preheader);
+ LS.Header->replacePhiUsesWith(OldPreheader, Preheader);
return Preheader;
}
OpenPOWER on IntegriCloud