[llvm-commits] [llvm] r54374 -	/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
    Owen Anderson 
    resistor at mac.com
       
    Tue Aug  5 14:40:48 PDT 2008
    
    
  
Author: resistor
Date: Tue Aug  5 16:40:45 2008
New Revision: 54374
URL: http://llvm.org/viewvc/llvm-project?rev=54374&view=rev
Log:
Correctly handle replacement and removal of PHIs with one incoming register.
Modified:
    llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=54374&r1=54373&r2=54374&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original)
+++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Tue Aug  5 16:40:45 2008
@@ -27,6 +27,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Type.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Target/TargetInstrInfo.h"
@@ -128,10 +129,15 @@
               start->RemoveOperand(i-1);
             }
           
-          if (start->getNumOperands() == 1) {
+          if (start->getNumOperands() == 3) {
             MachineInstr* phi = start;
+            unsigned Input = phi->getOperand(1).getReg();
+            unsigned Output = phi->getOperand(0).getReg();
+            
             start++;
             phi->eraseFromParent();
+            
+            F.getRegInfo().replaceRegWith(Output, Input);
           } else
             start++;
         }
    
    
More information about the llvm-commits
mailing list