Commit some changes I had managed to lose last night while refactoring the code. Avoid change use of PHI instructions because it's not legal to insert any instructions before them.
This fixes PR6027.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93335 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/OptimizeExts.cpp b/lib/CodeGen/OptimizeExts.cpp
index 844eb23..625ff89 100644
--- a/lib/CodeGen/OptimizeExts.cpp
+++ b/lib/CodeGen/OptimizeExts.cpp
@@ -110,6 +110,11 @@
       MachineInstr *UseMI = &*UI;
       if (UseMI == MI)
         continue;
+      if (UseMI->getOpcode() == TargetInstrInfo::PHI) {
+        ExtendLife = false;
+        continue;
+      }
+
       MachineBasicBlock *UseMBB = UseMI->getParent();
       if (UseMBB == MBB) {
         // Local uses that come after the extension.
@@ -117,7 +122,7 @@
           Uses.push_back(&UseMO);
       } else if (ReachedBBs.count(UseMBB))
         // Non-local uses where the result of extension is used. Always
-        // replace these.
+        // replace these unless it's a PHI.
         Uses.push_back(&UseMO);
       else if (Aggressive && DT->dominates(MBB, UseMBB))
         // We may want to extend live range of the extension result in order