[llvm-commits] [llvm] r94866 - /llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Dale Johannesen dalej at apple.com
Fri Jan 29 16:57:47 PST 2010


Author: johannes
Date: Fri Jan 29 18:57:47 2010
New Revision: 94866

URL: http://llvm.org/viewvc/llvm-project?rev=94866&view=rev
Log:
Fix a case where debug_value could affect codegen.


Modified:
    llvm/trunk/lib/CodeGen/RegAllocLocal.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLocal.cpp?rev=94866&r1=94865&r2=94866&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLocal.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLocal.cpp Fri Jan 29 18:57:47 2010
@@ -838,6 +838,18 @@
       }
     }
 
+    // If a DEBUG_VALUE says something is located in a spilled register,
+    // change the DEBUG_VALUE to be undef, which prevents the register
+    // from being reloaded here.  Doing that would change the generated
+    // code, unless another use immediately follows this instruction.
+    if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE &&
+        MI->getNumOperands()==3 && MI->getOperand(0).isReg()) {
+      unsigned VirtReg = MI->getOperand(0).getReg();
+      if (VirtReg && TargetRegisterInfo::isVirtualRegister(VirtReg) &&
+          !getVirt2PhysRegMapSlot(VirtReg))
+        MI->getOperand(0).setReg(0U);
+    }
+
     // Get the used operands into registers.  This has the potential to spill
     // incoming values if we are out of registers.  Note that we completely
     // ignore physical register uses here.  We assume that if an explicit





More information about the llvm-commits mailing list