For real this time: PHI Def & Kill tracking added to PHIElimination.
authorLang Hames <lhames@gmail.com>
Thu, 23 Jul 2009 05:44:24 +0000 (05:44 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 23 Jul 2009 05:44:24 +0000 (05:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76865 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/PHIElimination.cpp

index 1cbe7989452d11069091cf528de335c9654bb8a5..56dca086ef252163c04f285b7370ef8448f5eac3 100644 (file)
@@ -50,6 +50,8 @@ void llvm::PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const {
 bool llvm::PHIElimination::runOnMachineFunction(MachineFunction &Fn) {
   MRI = &Fn.getRegInfo();
 
+  PHIDefs.clear();
+  PHIKills.clear();
   analyzePHINodes(Fn);
 
   bool Changed = false;
@@ -183,8 +185,8 @@ void llvm::PHIElimination::LowerAtomicPHINode(
   }
 
   // Record PHI def.
-  //assert(!hasPHIDef(DestReg) && "Vreg has multiple phi-defs?"); 
-  //PHIDefs[DestReg] = &MBB;
+  assert(!hasPHIDef(DestReg) && "Vreg has multiple phi-defs?"); 
+  PHIDefs[DestReg] = &MBB;
 
   // Update live variable information if there is any.
   LiveVariables *LV = getAnalysisIfAvailable<LiveVariables>();
@@ -232,7 +234,7 @@ void llvm::PHIElimination::LowerAtomicPHINode(
     MachineBasicBlock &opBlock = *MPhi->getOperand(i*2+2).getMBB();
 
     // Record the kill.
-    //PHIKills[SrcReg].insert(&opBlock);
+    PHIKills[SrcReg].insert(&opBlock);
 
     // If source is defined by an implicit def, there is no need to insert a
     // copy.