[PATCH] D22653: AMDGPU: Don't reinvent transferSuccessorsAndUpdatePHIs
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 15:05:16 PDT 2016
arsenm created this revision.
arsenm added a subscriber: llvm-commits.
Herald added a reviewer: tstellarAMD.
Herald added subscribers: kzhuravl, arsenm.
https://reviews.llvm.org/D22653
Files:
lib/Target/AMDGPU/SIISelLowering.cpp
Index: lib/Target/AMDGPU/SIISelLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIISelLowering.cpp
+++ lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1072,24 +1072,6 @@
+ StringRef(RegName) + "\"."));
}
-static void replaceSuccessorPhisWith(MachineBasicBlock &BB,
- MachineBasicBlock &SplitBB) {
- for (MachineBasicBlock *Succ : BB.successors()) {
- for (MachineInstr &MI : *Succ) {
- if (!MI.isPHI())
- break;
-
- for (unsigned I = 2, E = MI.getNumOperands(); I != E; I += 2) {
- MachineOperand &FromBB = MI.getOperand(I);
- if (&BB == FromBB.getMBB()) {
- FromBB.setMBB(&SplitBB);
- break;
- }
- }
- }
- }
-}
-
// If kill is not the last instruction, split the block so kill is always a
// proper terminator.
MachineBasicBlock *SITargetLowering::splitKillBlock(MachineInstr &MI,
@@ -1109,14 +1091,10 @@
MachineBasicBlock *SplitBB
= MF->CreateMachineBasicBlock(BB->getBasicBlock());
- // Fix the block phi references to point to the new block for the defs in the
- // second piece of the block.
- replaceSuccessorPhisWith(*BB, *SplitBB);
-
MF->insert(++MachineFunction::iterator(BB), SplitBB);
SplitBB->splice(SplitBB->begin(), BB, SplitPoint, BB->end());
- SplitBB->transferSuccessors(BB);
+ SplitBB->transferSuccessorsAndUpdatePHIs(BB);
BB->addSuccessor(SplitBB);
MI.setDesc(TII->get(AMDGPU::SI_KILL_TERMINATOR));
@@ -1237,13 +1215,11 @@
MF->insert(MBBI, LoopBB);
MF->insert(MBBI, RemainderBB);
- replaceSuccessorPhisWith(MBB, *RemainderBB);
-
LoopBB->addSuccessor(LoopBB);
LoopBB->addSuccessor(RemainderBB);
// Move the rest of the block into a new block.
- RemainderBB->transferSuccessors(&MBB);
+ RemainderBB->transferSuccessorsAndUpdatePHIs(&MBB);
RemainderBB->splice(RemainderBB->begin(), &MBB, I, MBB.end());
MBB.addSuccessor(LoopBB);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22653.64971.patch
Type: text/x-patch
Size: 1992 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/93fd33d2/attachment.bin>
More information about the llvm-commits
mailing list