Insert phi code at top of block

llvm-svn: 5015
This commit is contained in:
Chris Lattner 2002-12-13 11:52:34 +00:00
parent 61edd534b4
commit d4c5013c04
1 changed files with 5 additions and 2 deletions

View File

@ -340,9 +340,12 @@ void ISel::SelectPHINodes() {
// Get the incoming value into a virtual register. If it is not already
// available in a virtual register, insert the computation code into
// PredMBB
MachineBasicBlock::iterator PI = PredMBB->end()-1;
//
MachineBasicBlock::iterator PI = PredMBB->begin();
while ((*PI)->getOpcode() == X86::PHI) ++PI;
MI->addRegOperand(getReg(PN->getIncomingValue(i), PredMBB, PI));
// FIXME: Pass in the MachineBasicBlocks instead of the basic blocks...
MI->addPCDispOperand(PN->getIncomingBlock(i)); // PredMBB