Correctly compute live variable information for physical registers
when an implicitely defined register is later used by an alias. For example:

         call foo
         %reg1024 = mov %AL

The call implicitely defines EAX but only AL is used. Before this fix
no information was available on AL. Now EAX and all its aliases except
AL get defined and die at the call instruction whereas AL lives to be
killed by the assignment.

llvm-svn: 10813
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp
index a622b05..1bfc6e5 100644
--- a/llvm/lib/CodeGen/LiveVariables.cpp
+++ b/llvm/lib/CodeGen/LiveVariables.cpp
@@ -117,14 +117,6 @@
   if (PhysRegInfo[Reg]) {
     PhysRegInfo[Reg] = MI;
     PhysRegUsed[Reg] = true;
-  } else {
-    for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
-         *AliasSet; ++AliasSet) {
-      if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) {
-	PhysRegInfo[*AliasSet] = MI;
-	PhysRegUsed[*AliasSet] = true;
-      }
-    }
   }
 }
 
@@ -135,20 +127,21 @@
       RegistersKilled.insert(std::make_pair(LastUse, Reg));
     else
       RegistersDead.insert(std::make_pair(LastUse, Reg));
-  } else {
-    for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
-         *AliasSet; ++AliasSet) {
-      if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) {
-	if (PhysRegUsed[*AliasSet])
-	  RegistersKilled.insert(std::make_pair(LastUse, *AliasSet));
-	else
-	  RegistersDead.insert(std::make_pair(LastUse, *AliasSet));
-	PhysRegInfo[*AliasSet] = 0;  // Kill the aliased register
-      }
-    }
   }
   PhysRegInfo[Reg] = MI;
   PhysRegUsed[Reg] = false;
+
+  for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg);
+       *AliasSet; ++AliasSet) {
+    if (MachineInstr *LastUse = PhysRegInfo[*AliasSet]) {
+      if (PhysRegUsed[*AliasSet])
+	RegistersKilled.insert(std::make_pair(LastUse, *AliasSet));
+      else
+	RegistersDead.insert(std::make_pair(LastUse, *AliasSet));
+    }
+    PhysRegInfo[*AliasSet] = MI;
+    PhysRegUsed[*AliasSet] = false;
+  }
 }
 
 bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {