[llvm-commits] CVS: llvm/lib/CodeGen/VirtRegMap.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 27 21:43:31 PDT 2006



Changes in directory llvm/lib/CodeGen:

VirtRegMap.cpp updated: 1.59 -> 1.60
---
Log message:

Mapping of physregs can make it so that the designated and input physregs are
the same.  In this case, don't emit a noop copy.


---
Diffs of the changes:  (+13 -0)

 VirtRegMap.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+)


Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.59 llvm/lib/CodeGen/VirtRegMap.cpp:1.60
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.59	Thu Apr 27 20:46:50 2006
+++ llvm/lib/CodeGen/VirtRegMap.cpp	Thu Apr 27 23:43:18 2006
@@ -611,6 +611,19 @@
           DesignatedReg = ReusedOperands.GetRegForReload(DesignatedReg, &MI, 
                                                       Spills, MaybeDeadStores);
         
+        // If the mapped designated register is actually the physreg we have
+        // incoming, we don't need to inserted a dead copy.
+        if (DesignatedReg == PhysReg) {
+          // If this stack slot value is already available, reuse it!
+          DEBUG(std::cerr << "Reusing SS#" << StackSlot << " from physreg "
+                          << MRI->getName(PhysReg) << " for vreg"
+                          << VirtReg
+                          << " instead of reloading into same physreg.\n");
+          MI.SetMachineOperandReg(i, PhysReg);
+          ++NumReused;
+          continue;
+        }
+        
         const TargetRegisterClass* RC =
           MBB.getParent()->getSSARegMap()->getRegClass(VirtReg);
 






More information about the llvm-commits mailing list