mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
If BB is empty, insert PHI before end() instead of front().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6bfcba7e13
commit
7e572eb37f
@ -157,8 +157,9 @@ unsigned MachineSSAUpdater::GetValueInMiddleOfBlock(MachineBasicBlock *BB) {
|
|||||||
return SingularValue;
|
return SingularValue;
|
||||||
|
|
||||||
// Otherwise, we do need a PHI: insert one now.
|
// Otherwise, we do need a PHI: insert one now.
|
||||||
|
MachineBasicBlock::iterator Loc = BB->empty() ? BB->end() : BB->front();
|
||||||
MachineInstr *InsertedPHI = InsertNewDef(TargetInstrInfo::PHI, BB,
|
MachineInstr *InsertedPHI = InsertNewDef(TargetInstrInfo::PHI, BB,
|
||||||
BB->front(), VRC, MRI, TII);
|
Loc, VRC, MRI, TII);
|
||||||
|
|
||||||
// Fill in all the predecessors of the PHI.
|
// Fill in all the predecessors of the PHI.
|
||||||
MachineInstrBuilder MIB(InsertedPHI);
|
MachineInstrBuilder MIB(InsertedPHI);
|
||||||
@ -231,7 +232,8 @@ unsigned MachineSSAUpdater::GetValueAtEndOfBlockInternal(MachineBasicBlock *BB){
|
|||||||
// that we have a cycle. Handle this by inserting a PHI node and returning
|
// that we have a cycle. Handle this by inserting a PHI node and returning
|
||||||
// it. When we get back to the first instance of the recursion we will fill
|
// it. When we get back to the first instance of the recursion we will fill
|
||||||
// in the PHI node.
|
// in the PHI node.
|
||||||
MachineInstr *NewPHI = InsertNewDef(TargetInstrInfo::PHI, BB, BB->front(),
|
MachineBasicBlock::iterator Loc = BB->empty() ? BB->end() : BB->front();
|
||||||
|
MachineInstr *NewPHI = InsertNewDef(TargetInstrInfo::PHI, BB, Loc,
|
||||||
VRC, MRI,TII);
|
VRC, MRI,TII);
|
||||||
unsigned NewVR = NewPHI->getOperand(0).getReg();
|
unsigned NewVR = NewPHI->getOperand(0).getReg();
|
||||||
InsertRes.first->second = NewVR;
|
InsertRes.first->second = NewVR;
|
||||||
@ -311,7 +313,8 @@ unsigned MachineSSAUpdater::GetValueAtEndOfBlockInternal(MachineBasicBlock *BB){
|
|||||||
// Otherwise, we do need a PHI: insert one now if we don't already have one.
|
// Otherwise, we do need a PHI: insert one now if we don't already have one.
|
||||||
MachineInstr *InsertedPHI;
|
MachineInstr *InsertedPHI;
|
||||||
if (InsertedVal == 0) {
|
if (InsertedVal == 0) {
|
||||||
InsertedPHI = InsertNewDef(TargetInstrInfo::PHI, BB, BB->front(),
|
MachineBasicBlock::iterator Loc = BB->empty() ? BB->end() : BB->front();
|
||||||
|
InsertedPHI = InsertNewDef(TargetInstrInfo::PHI, BB, Loc,
|
||||||
VRC, MRI, TII);
|
VRC, MRI, TII);
|
||||||
InsertedVal = InsertedPHI->getOperand(0).getReg();
|
InsertedVal = InsertedPHI->getOperand(0).getReg();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user