mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-19 18:10:14 +00:00
Fix for PR4124. Make TwoAddressFormPass::FindLastUseInMBB return the real last use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f957012866
commit
a7c9deaa2b
@ -316,7 +316,7 @@ bool TwoAddressInstructionPass::NoUseAfterLastDef(unsigned Reg,
|
|||||||
MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
|
MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
|
||||||
MachineBasicBlock *MBB,
|
MachineBasicBlock *MBB,
|
||||||
unsigned Dist) {
|
unsigned Dist) {
|
||||||
unsigned LastUseDist = Dist;
|
unsigned LastUseDist = 0;
|
||||||
MachineInstr *LastUse = 0;
|
MachineInstr *LastUse = 0;
|
||||||
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg),
|
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg),
|
||||||
E = MRI->reg_end(); I != E; ++I) {
|
E = MRI->reg_end(); I != E; ++I) {
|
||||||
@ -327,7 +327,10 @@ MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
|
|||||||
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(MI);
|
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(MI);
|
||||||
if (DI == DistanceMap.end())
|
if (DI == DistanceMap.end())
|
||||||
continue;
|
continue;
|
||||||
if (MO.isUse() && DI->second < LastUseDist) {
|
if (DI->second >= Dist)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (MO.isUse() && DI->second > LastUseDist) {
|
||||||
LastUse = DI->first;
|
LastUse = DI->first;
|
||||||
LastUseDist = DI->second;
|
LastUseDist = DI->second;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user