[llvm-commits] [llvm] r107302 - in /llvm/trunk/lib/CodeGen: InlineSpiller.cpp Spiller.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jun 30 11:19:08 PDT 2010


Author: stoklund
Date: Wed Jun 30 13:19:08 2010
New Revision: 107302

URL: http://llvm.org/viewvc/llvm-project?rev=107302&view=rev
Log:
Remember to track spill slot uses in VirtRegMap when inserting loads and stores.
LocalRewriter::runOnMachineFunction uses this information to mark dead spill
slots.

This means that InlineSpiller now also works for functions that spill.

Modified:
    llvm/trunk/lib/CodeGen/InlineSpiller.cpp
    llvm/trunk/lib/CodeGen/Spiller.cpp

Modified: llvm/trunk/lib/CodeGen/InlineSpiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InlineSpiller.cpp?rev=107302&r1=107301&r2=107302&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/InlineSpiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/InlineSpiller.cpp Wed Jun 30 13:19:08 2010
@@ -95,6 +95,7 @@
       tii_.loadRegFromStackSlot(*MI->getParent(), MII, NewVReg, SS, RC, &tri_);
       --MII; // Point to load instruction.
       SlotIndex LoadIdx = lis_.InsertMachineInstrInMaps(MII).getDefIndex();
+      vrm_.addSpillSlotUse(SS, MII);
       DEBUG(dbgs() << "\treload:  " << LoadIdx << '\t' << *MII);
       VNInfo *LoadVNI = NewLI.getNextValue(LoadIdx, 0, true,
                                            lis_.getVNInfoAllocator());
@@ -124,6 +125,7 @@
                                &tri_);
       --MII; // Point to store instruction.
       SlotIndex StoreIdx = lis_.InsertMachineInstrInMaps(MII).getDefIndex();
+      vrm_.addSpillSlotUse(SS, MII);
       DEBUG(dbgs() << "\tspilled: " << StoreIdx << '\t' << *MII);
       VNInfo *StoreVNI = NewLI.getNextValue(Idx, 0, true,
                                             lis_.getVNInfoAllocator());

Modified: llvm/trunk/lib/CodeGen/Spiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.cpp?rev=107302&r1=107301&r2=107302&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Spiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/Spiller.cpp Wed Jun 30 13:19:08 2010
@@ -137,6 +137,7 @@
         MachineInstr *loadInstr(prior(miItr));
         SlotIndex loadIndex =
           lis->InsertMachineInstrInMaps(loadInstr).getDefIndex();
+        vrm->addSpilSlotUse(ss, loadInstr);
         SlotIndex endIndex = loadIndex.getNextIndex();
         VNInfo *loadVNI =
           newLI->getNextValue(loadIndex, 0, true, lis->getVNInfoAllocator());
@@ -150,6 +151,7 @@
         MachineInstr *storeInstr(llvm::next(miItr));
         SlotIndex storeIndex =
           lis->InsertMachineInstrInMaps(storeInstr).getDefIndex();
+        vrm->addSpilSlotUse(ss, storeInstr);
         SlotIndex beginIndex = storeIndex.getPrevIndex();
         VNInfo *storeVNI =
           newLI->getNextValue(beginIndex, 0, true, lis->getVNInfoAllocator());





More information about the llvm-commits mailing list