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

Evan Cheng evan.cheng at apple.com
Fri Mar 30 13:21:52 PDT 2007



Changes in directory llvm/lib/CodeGen:

VirtRegMap.cpp updated: 1.107 -> 1.108
---
Log message:

Don't add the same MI to register reuse "last def/use" twice if it reads the
register more than once.

---
Diffs of the changes:  (+4 -1)

 VirtRegMap.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.107 llvm/lib/CodeGen/VirtRegMap.cpp:1.108
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.107	Mon Mar 26 19:48:28 2007
+++ llvm/lib/CodeGen/VirtRegMap.cpp	Fri Mar 30 15:21:35 2007
@@ -316,7 +316,9 @@
       assert(II != SpillSlotsAvailable.end() && "Slot not available!");
       unsigned Val = II->second.first;
       assert((Val >> 1) == PhysReg && "Bidirectional map mismatch!");
-      II->second.second.push_back(Use);
+      // This can be true if there are multiple uses of the same register.
+      if (II->second.second.back() != Use)
+        II->second.second.push_back(Use);
     }
   }
   
@@ -1117,6 +1119,7 @@
           if (TII->isMoveInstr(MI, Src, Dst) && Src == Dst) {
             ++NumDCE;
             DOUT << "Removing now-noop copy: " << MI;
+            Spills.removeLastUse(Src, &MI);
             MBB.erase(&MI);
             VRM.RemoveFromFoldedVirtMap(&MI);
             goto ProcessNextInst;






More information about the llvm-commits mailing list