mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-30 15:22:41 +00:00
Fix for the original bug in PR5495 - Look at uses as well as defs when determining the PHI-copy insert point.
- Patch by Andrew Canis! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88880 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a44321776e
commit
b126d0530d
@ -141,10 +141,10 @@ llvm::PHIElimination::FindCopyInsertPoint(MachineBasicBlock &MBB,
|
|||||||
if (!SuccMBB.isLandingPad())
|
if (!SuccMBB.isLandingPad())
|
||||||
return MBB.getFirstTerminator();
|
return MBB.getFirstTerminator();
|
||||||
|
|
||||||
// Discover any definitions in this basic block.
|
// Discover any defs/uses in this basic block.
|
||||||
SmallPtrSet<MachineInstr*, 8> DefUsesInMBB;
|
SmallPtrSet<MachineInstr*, 8> DefUsesInMBB;
|
||||||
for (MachineRegisterInfo::def_iterator RI = MRI->def_begin(SrcReg),
|
for (MachineRegisterInfo::reg_iterator RI = MRI->reg_begin(SrcReg),
|
||||||
RE = MRI->def_end(); RI != RE; ++RI) {
|
RE = MRI->reg_end(); RI != RE; ++RI) {
|
||||||
MachineInstr *DefUseMI = &*RI;
|
MachineInstr *DefUseMI = &*RI;
|
||||||
if (DefUseMI->getParent() == &MBB)
|
if (DefUseMI->getParent() == &MBB)
|
||||||
DefUsesInMBB.insert(DefUseMI);
|
DefUsesInMBB.insert(DefUseMI);
|
||||||
@ -155,11 +155,11 @@ llvm::PHIElimination::FindCopyInsertPoint(MachineBasicBlock &MBB,
|
|||||||
// No defs. Insert the copy at the start of the basic block.
|
// No defs. Insert the copy at the start of the basic block.
|
||||||
InsertPoint = MBB.begin();
|
InsertPoint = MBB.begin();
|
||||||
} else if (DefUsesInMBB.size() == 1) {
|
} else if (DefUsesInMBB.size() == 1) {
|
||||||
// Insert the copy immediately after the def.
|
// Insert the copy immediately after the def/use.
|
||||||
InsertPoint = *DefUsesInMBB.begin();
|
InsertPoint = *DefUsesInMBB.begin();
|
||||||
++InsertPoint;
|
++InsertPoint;
|
||||||
} else {
|
} else {
|
||||||
// Insert the copy immediately after the last def.
|
// Insert the copy immediately after the last def/use.
|
||||||
InsertPoint = MBB.end();
|
InsertPoint = MBB.end();
|
||||||
while (!DefUsesInMBB.count(&*--InsertPoint)) {}
|
while (!DefUsesInMBB.count(&*--InsertPoint)) {}
|
||||||
++InsertPoint;
|
++InsertPoint;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user