[llvm-commits] [llvm] r71769 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Lang Hames
lhames at gmail.com
Wed May 13 21:26:36 PDT 2009
Author: lhames
Date: Wed May 13 23:26:30 2009
New Revision: 71769
URL: http://llvm.org/viewvc/llvm-project?rev=71769&view=rev
Log:
Fix for PR4124. Make TwoAddressFormPass::FindLastUseInMBB return the real last use.
Modified:
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=71769&r1=71768&r2=71769&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed May 13 23:26:30 2009
@@ -316,7 +316,7 @@
MachineInstr *TwoAddressInstructionPass::FindLastUseInMBB(unsigned Reg,
MachineBasicBlock *MBB,
unsigned Dist) {
- unsigned LastUseDist = Dist;
+ unsigned LastUseDist = 0;
MachineInstr *LastUse = 0;
for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(Reg),
E = MRI->reg_end(); I != E; ++I) {
@@ -327,7 +327,10 @@
DenseMap<MachineInstr*, unsigned>::iterator DI = DistanceMap.find(MI);
if (DI == DistanceMap.end())
continue;
- if (MO.isUse() && DI->second < LastUseDist) {
+ if (DI->second >= Dist)
+ continue;
+
+ if (MO.isUse() && DI->second > LastUseDist) {
LastUse = DI->first;
LastUseDist = DI->second;
}
More information about the llvm-commits
mailing list