Index: test/CodeGen/X86/2011-05-20-LiveVariablesRegKillBug.ll
===================================================================
--- test/CodeGen/X86/2011-05-20-LiveVariablesRegKillBug.ll	(revision 0)
+++ test/CodeGen/X86/2011-05-20-LiveVariablesRegKillBug.ll	(revision 0)
@@ -0,0 +1,16 @@
+; RUN: llc < %s -march=x86-64 -mcpu=corei7
+; END.
+
+%0 = type opaque
+
+define void @LiveVariablesRegKillBug(%0* nocapture %arg0) nounwind {
+entry:
+  %charPointer = bitcast %0* %arg0 to i8*
+  %0 = getelementptr i8* %charPointer, i64 1040
+  %varA = bitcast i8* %0 to <4 x float>*
+  %1 = getelementptr i8* %charPointer, i64 512
+  %2 = bitcast i8* %1 to <4 x float>*
+  %varB = load <4 x float>* %2, align 1
+  store <4 x float> %varB, <4 x float>* %varA, align 1
+  ret void
+}
Index: lib/CodeGen/LiveVariables.cpp
===================================================================
--- lib/CodeGen/LiveVariables.cpp	(revision 131740)
+++ lib/CodeGen/LiveVariables.cpp	(working copy)
@@ -619,13 +619,14 @@
 
   // Convert and transfer the dead / killed information we have gathered into
   // VirtRegInfo onto MI's.
-  for (unsigned i = 0, e1 = VirtRegInfo.size(); i != e1; ++i) {
+  for (unsigned i = 0, e1 = MRI->getNumVirtRegs(); i != e1; ++i) {
     const unsigned Reg = TargetRegisterInfo::index2VirtReg(i);
-    for (unsigned j = 0, e2 = VirtRegInfo[Reg].Kills.size(); j != e2; ++j)
-      if (VirtRegInfo[Reg].Kills[j] == MRI->getVRegDef(Reg))
-        VirtRegInfo[Reg].Kills[j]->addRegisterDead(Reg, TRI);
+    VarInfo &VI = getVarInfo(Reg);
+    for (unsigned j = 0, e2 = VI.Kills.size(); j != e2; ++j)
+      if (VI.Kills[j] == MRI->getVRegDef(Reg))
+        VI.Kills[j]->addRegisterDead(Reg, TRI);
       else
-        VirtRegInfo[Reg].Kills[j]->addRegisterKilled(Reg, TRI);
+        VI.Kills[j]->addRegisterKilled(Reg, TRI);
   }
 
   // Check to make sure there are no unreachable blocks in the MC CFG for the
