[llvm-commits] [llvm] r43869 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Owen Anderson resistor at mac.com
Wed Nov 7 17:32:46 PST 2007


Author: resistor
Date: Wed Nov  7 19:32:45 2007
New Revision: 43869

URL: http://llvm.org/viewvc/llvm-project?rev=43869&view=rev
Log:
Take another stab at getting isLiveIn() and isLiveOut() right.

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

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=43869&r1=43868&r2=43869&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Nov  7 19:32:45 2007
@@ -225,10 +225,9 @@
   if (V.AliveBlocks.test(MBB->getNumber()))
     return true;
   
-  for (std::vector<MachineInstr*>::iterator I = V.Kills.begin(),
-       E = V.Kills.end(); I != E; ++I)
-    if ((*I)->getParent() == MBB)
-      return true;
+  if (V.DefInst->getParent() != MBB &&
+      V.UsedBlocks.test(MBB->getNumber()))
+    return true;
   
   return false;
 }
@@ -236,11 +235,15 @@
 /// isLiveOut - help method that determines, from a VarInfo, if a register is
 /// live out of a block.
 bool isLiveOut(LiveVariables::VarInfo& V, MachineBasicBlock* MBB) {
-  if (V.AliveBlocks.test(MBB->getNumber()))
-    return true;
-  
-  if (V.DefInst->getParent() == MBB)
+  if (MBB == V.DefInst->getParent() ||
+      V.UsedBlocks.test(MBB->getNumber())) {
+    for (std::vector<MachineInstr*>::iterator I = V.Kills.begin(), 
+         E = V.Kills.end(); I != E; ++I)
+      if ((*I)->getParent() == MBB)
+        return false;
+    
     return true;
+  }
   
   return false;
 }





More information about the llvm-commits mailing list