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

Owen Anderson resistor at mac.com
Tue Apr 1 19:12:47 PDT 2008


Author: resistor
Date: Tue Apr  1 21:12:45 2008
New Revision: 49069

URL: http://llvm.org/viewvc/llvm-project?rev=49069&view=rev
Log:
Correctly mark a valno that was previous defined by a PHI node as having an
unknown defining inst after PHI elimination.

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=49069&r1=49068&r2=49069&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Apr  1 21:12:45 2008
@@ -845,7 +845,6 @@
 }
 
 bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) {
-  
   LiveIntervals& LI = getAnalysis<LiveIntervals>();
   
   // Compute DFS numbers of each block
@@ -889,17 +888,21 @@
     
     // If this is a dead PHI node, then remove it from LiveIntervals.
     unsigned DestReg = PInstr->getOperand(0).getReg();
+    LiveInterval& PI = LI.getInterval(DestReg);
     if (PInstr->registerDefIsDead(DestReg)) {
-      LiveInterval& PI = LI.getInterval(DestReg);
-      
       if (PI.containsOneValue()) {
         LI.removeInterval(DestReg);
       } else {
         unsigned idx = LI.getDefIndex(LI.getInstructionIndex(PInstr));
         PI.removeRange(*PI.getLiveRangeContaining(idx), true);
       }
+    } else {
+      // If the PHI is not dead, then the valno defined by the PHI
+      // now has an unknown def.
+      unsigned idx = LI.getDefIndex(LI.getInstructionIndex(PInstr));
+      PI.getLiveRangeContaining(idx)->valno->def = ~0U;
     }
-      
+    
     LI.RemoveMachineInstrFromMaps(PInstr);
     PInstr->eraseFromParent();
   }





More information about the llvm-commits mailing list