Copies need to be inserted before the first terminator, not at the end of the block.
authorOwen Anderson <resistor@mac.com>
Thu, 10 Jan 2008 00:01:41 +0000 (00:01 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 10 Jan 2008 00:01:41 +0000 (00:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45791 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/StrongPHIElimination.cpp

index f7e44dd2fc351e3cc6f12dc81e79c2130b2d851a..da5170af637d4eb3f8a82161c100d434e239201e 100644 (file)
@@ -613,7 +613,7 @@ void StrongPHIElimination::ScheduleCopies(MachineBasicBlock* MBB,
       }
       
       // Insert copy from map[curr.first] to curr.second
-      TII->copyRegToReg(*MBB, MBB->end(), curr.second,
+      TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), curr.second,
                         map[curr.first], RC, RC);
       map[curr.first] = curr.second;
       
@@ -642,7 +642,7 @@ void StrongPHIElimination::ScheduleCopies(MachineBasicBlock* MBB,
       
       // Insert a copy from dest to a new temporary t at the end of b
       unsigned t = MF->getRegInfo().createVirtualRegister(RC);
-      TII->copyRegToReg(*MBB, MBB->end(), t,
+      TII->copyRegToReg(*MBB, MBB->getFirstTerminator(), t,
                         curr.second, RC, RC);
       map[curr.second] = t;