[llvm-commits] [llvm] r128645 - in /llvm/trunk: lib/CodeGen/VirtRegMap.cpp test/CodeGen/Blackfin/2009-08-04-LowerExtract-Live.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Mar 31 10:55:25 PDT 2011


Author: stoklund
Date: Thu Mar 31 12:55:25 2011
New Revision: 128645

URL: http://llvm.org/viewvc/llvm-project?rev=128645&view=rev
Log:
Don't completely eliminate identity copies that also modify super register liveness.

Turn them into noop KILL instructions instead. This lets the scavenger know when
super-registers are killed and defined.

Modified:
    llvm/trunk/lib/CodeGen/VirtRegMap.cpp
    llvm/trunk/test/CodeGen/Blackfin/2009-08-04-LowerExtract-Live.ll

Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=128645&r1=128644&r2=128645&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Thu Mar 31 12:55:25 2011
@@ -309,12 +309,18 @@
 
       // Finally, remove any identity copies.
       if (MI->isIdentityCopy()) {
-        DEBUG(dbgs() << "Deleting identity copy.\n");
-        RemoveMachineInstrFromMaps(MI);
-        if (Indexes)
-          Indexes->removeMachineInstrFromMaps(MI);
-        // It's safe to erase MI because MII has already been incremented.
-        MI->eraseFromParent();
+        if (MI->getNumOperands() == 2) {
+          DEBUG(dbgs() << "Deleting identity copy.\n");
+          RemoveMachineInstrFromMaps(MI);
+          if (Indexes)
+            Indexes->removeMachineInstrFromMaps(MI);
+          // It's safe to erase MI because MII has already been incremented.
+          MI->eraseFromParent();
+        } else {
+          // Transform identity copy to a KILL to deal with subregisters.
+          MI->setDesc(TII->get(TargetOpcode::KILL));
+          DEBUG(dbgs() << "Identity copy: " << *MI);
+        }
       }
     }
   }

Modified: llvm/trunk/test/CodeGen/Blackfin/2009-08-04-LowerExtract-Live.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Blackfin/2009-08-04-LowerExtract-Live.ll?rev=128645&r1=128644&r2=128645&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Blackfin/2009-08-04-LowerExtract-Live.ll (original)
+++ llvm/trunk/test/CodeGen/Blackfin/2009-08-04-LowerExtract-Live.ll Thu Mar 31 12:55:25 2011
@@ -1,4 +1,5 @@
 ; RUN: llc < %s -march=bfin -join-liveintervals=0 -verify-machineinstrs
+; RUN: llc < %s -march=bfin -join-liveintervals=0 -verify-machineinstrs -regalloc=greedy
 
 ; Provoke an error in LowerSubregsPass::LowerExtract where the live range of a
 ; super-register is illegally extended.





More information about the llvm-commits mailing list