Insert phi code at top of block
authorChris Lattner <sabre@nondot.org>
Fri, 13 Dec 2002 11:52:34 +0000 (11:52 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 13 Dec 2002 11:52:34 +0000 (11:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5015 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86ISelSimple.cpp

index 4cb6562211da599683df95e963dd890517cbb277..cad8e0d912f1bb1b898769dcf5d9b088a6c24f57 100644 (file)
@@ -340,9 +340,12 @@ void ISel::SelectPHINodes() {
         // Get the incoming value into a virtual register.  If it is not already
         // available in a virtual register, insert the computation code into
         // PredMBB
-        MachineBasicBlock::iterator PI = PredMBB->end()-1;
+        //
+
+        MachineBasicBlock::iterator PI = PredMBB->begin();
+        while ((*PI)->getOpcode() == X86::PHI) ++PI;
+        
         MI->addRegOperand(getReg(PN->getIncomingValue(i), PredMBB, PI));
-                                 
 
         // FIXME: Pass in the MachineBasicBlocks instead of the basic blocks...
         MI->addPCDispOperand(PN->getIncomingBlock(i));  // PredMBB
index 4cb6562211da599683df95e963dd890517cbb277..cad8e0d912f1bb1b898769dcf5d9b088a6c24f57 100644 (file)
@@ -340,9 +340,12 @@ void ISel::SelectPHINodes() {
         // Get the incoming value into a virtual register.  If it is not already
         // available in a virtual register, insert the computation code into
         // PredMBB
-        MachineBasicBlock::iterator PI = PredMBB->end()-1;
+        //
+
+        MachineBasicBlock::iterator PI = PredMBB->begin();
+        while ((*PI)->getOpcode() == X86::PHI) ++PI;
+        
         MI->addRegOperand(getReg(PN->getIncomingValue(i), PredMBB, PI));
-                                 
 
         // FIXME: Pass in the MachineBasicBlocks instead of the basic blocks...
         MI->addPCDispOperand(PN->getIncomingBlock(i));  // PredMBB