diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2019-08-30 11:23:10 +0000 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2019-08-30 11:23:10 +0000 |
commit | 227145924a5f38469b8113e65bc367b742bd0ea6 (patch) | |
tree | 6e2ba569519c5e28fe614a0dca589bb2f804884b /llvm/lib/CodeGen/MachinePipeliner.cpp | |
parent | 9bad66393bf8e3cd8e7acd7a8b2ea37e67e00d3c (diff) | |
download | bcm5719-llvm-227145924a5f38469b8113e65bc367b742bd0ea6.tar.gz bcm5719-llvm-227145924a5f38469b8113e65bc367b742bd0ea6.zip |
[CodeGen] Introduce MachineBasicBlock::replacePhiUsesWith helper and use it. NFC
Summary:
Found a couple of places in the code where all the PHI nodes
of a MBB is updated, replacing references to one MBB by
reference to another MBB instead.
This patch simply refactors the code to use a common helper
(MachineBasicBlock::replacePhiUsesWith) for such PHI node
updates.
Reviewers: t.p.northover, arsenm, uabelho
Subscribers: wdng, hiraditya, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66750
llvm-svn: 370463
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePipeliner.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp index 584b2a1eaec..3814f77f5be 100644 --- a/llvm/lib/CodeGen/MachinePipeliner.cpp +++ b/llvm/lib/CodeGen/MachinePipeliner.cpp @@ -2234,15 +2234,7 @@ void SwingSchedulerDAG::generateEpilog(SMSchedule &Schedule, unsigned LastStage, } // Fix any Phi nodes in the loop exit block. - for (MachineInstr &MI : *LoopExitBB) { - if (!MI.isPHI()) - break; - for (unsigned i = 2, e = MI.getNumOperands() + 1; i != e; i += 2) { - MachineOperand &MO = MI.getOperand(i); - if (MO.getMBB() == BB) - MO.setMBB(PredBB); - } - } + LoopExitBB->replacePhiUsesWith(BB, PredBB); // Create a branch to the new epilog from the kernel. // Remove the original branch and add a new branch to the epilog. |