summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-06 15:49:48 +0000
committerDan Gohman <gohman@apple.com>2010-07-06 15:49:48 +0000
commitf4f04107ef62ed845d83eef163e7761bea6b2856 (patch)
tree87b84ea55b541a3032522c772002d01d7d4bbfb7 /llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
parent33134fa75fcd0d671b6c46b3669505883bfaef6f (diff)
downloadbcm5719-llvm-f4f04107ef62ed845d83eef163e7761bea6b2856.tar.gz
bcm5719-llvm-f4f04107ef62ed845d83eef163e7761bea6b2856.zip
Revert r107655.
llvm-svn: 107668
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/PIC16/PIC16ISelLowering.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp b/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
index 44c040a3352..d4369bc5075 100644
--- a/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
+++ b/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp
@@ -1928,12 +1928,15 @@ PIC16TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
F->insert(It, copy0MBB);
F->insert(It, sinkMBB);
- // Transfer the remainder of BB and its successor edges to sinkMBB.
- sinkMBB->splice(sinkMBB->begin(), BB,
- llvm::next(MachineBasicBlock::iterator(MI)),
- BB->end());
- sinkMBB->transferSuccessorsAndUpdatePHIs(BB);
-
+ // Update machine-CFG edges by first adding all successors of the current
+ // block to the new block which will contain the Phi node for the select.
+ for (MachineBasicBlock::succ_iterator I = BB->succ_begin(),
+ E = BB->succ_end(); I != E; ++I)
+ sinkMBB->addSuccessor(*I);
+ // Next, remove all successors of the current block, and add the true
+ // and fallthrough blocks as its successors.
+ while (!BB->succ_empty())
+ BB->removeSuccessor(BB->succ_begin());
// Next, add the true and fallthrough blocks as its successors.
BB->addSuccessor(copy0MBB);
BB->addSuccessor(sinkMBB);
@@ -1950,12 +1953,11 @@ PIC16TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
// %Result = phi [ %FalseValue, copy0MBB ], [ %TrueValue, thisMBB ]
// ...
BB = sinkMBB;
- BuildMI(*BB, BB->begin(), dl,
- TII.get(PIC16::PHI), MI->getOperand(0).getReg())
+ BuildMI(BB, dl, TII.get(PIC16::PHI), MI->getOperand(0).getReg())
.addReg(MI->getOperand(2).getReg()).addMBB(copy0MBB)
.addReg(MI->getOperand(1).getReg()).addMBB(thisMBB);
- MI->eraseFromParent(); // The pseudo instruction is gone now.
+ F->DeleteMachineInstr(MI); // The pseudo instruction is gone now.
return BB;
}
OpenPOWER on IntegriCloud