[llvm-branch-commits] [llvm-branch] r113531 - in /llvm/branches/release_28: ./ lib/CodeGen/VirtRegRewriter.cpp

Bill Wendling isanbard at gmail.com
Thu Sep 9 13:13:48 PDT 2010


Author: void
Date: Thu Sep  9 15:13:48 2010
New Revision: 113531

URL: http://llvm.org/viewvc/llvm-project?rev=113531&view=rev
Log:
Approved by Evan:

$ svn merge -c 113299 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r113299 into '.':
U    lib/CodeGen/VirtRegRewriter.cpp


Modified:
    llvm/branches/release_28/   (props changed)
    llvm/branches/release_28/lib/CodeGen/VirtRegRewriter.cpp

Propchange: llvm/branches/release_28/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep  9 15:13:48 2010
@@ -1,2 +1,2 @@
 /llvm/branches/Apple/Pertwee:110850,110961
-/llvm/trunk:113109,113123,113146,113158,113255,113257,113260,113303,113345,113483-113485
+/llvm/trunk:113109,113123,113146,113158,113255,113257,113260,113299,113303,113345,113483-113485

Modified: llvm/branches/release_28/lib/CodeGen/VirtRegRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_28/lib/CodeGen/VirtRegRewriter.cpp?rev=113531&r1=113530&r2=113531&view=diff
==============================================================================
--- llvm/branches/release_28/lib/CodeGen/VirtRegRewriter.cpp (original)
+++ llvm/branches/release_28/lib/CodeGen/VirtRegRewriter.cpp Thu Sep  9 15:13:48 2010
@@ -67,23 +67,16 @@
 /// Note that operands may be added, so the MO reference is no longer valid.
 static void substitutePhysReg(MachineOperand &MO, unsigned Reg,
                               const TargetRegisterInfo &TRI) {
-  if (unsigned SubIdx = MO.getSubReg()) {
-    // Insert the physical subreg and reset the subreg field.
-    MO.setReg(TRI.getSubReg(Reg, SubIdx));
-    MO.setSubReg(0);
-
-    // Any def, dead, and kill flags apply to the full virtual register, so they
-    // also apply to the full physical register. Add imp-def/dead and imp-kill
-    // as needed.
+  if (MO.getSubReg()) {
+    MO.substPhysReg(Reg, TRI);
+
+    // Any kill flags apply to the full virtual register, so they also apply to
+    // the full physical register.
+    // We assume that partial defs have already been decorated with a super-reg
+    // <imp-def> operand by LiveIntervals.
     MachineInstr &MI = *MO.getParent();
-    if (MO.isDef())
-      if (MO.isDead())
-        MI.addRegisterDead(Reg, &TRI, /*AddIfNotFound=*/ true);
-      else
-        MI.addRegisterDefined(Reg, &TRI);
-    else if (!MO.isUndef() &&
-             (MO.isKill() ||
-              MI.isRegTiedToDefOperand(&MO-&MI.getOperand(0))))
+    if (MO.isUse() && !MO.isUndef() &&
+        (MO.isKill() || MI.isRegTiedToDefOperand(&MO-&MI.getOperand(0))))
       MI.addRegisterKilled(Reg, &TRI, /*AddIfNotFound=*/ true);
   } else {
     MO.setReg(Reg);





More information about the llvm-branch-commits mailing list