aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/OptimizeExts.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-01-13 19:16:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-01-13 19:16:39 +0000
commiteb18812f755b634f3e7554c1912aeb2d7476cb53 (patch)
tree4b6f92ee09fa75387429d6cb0894504df33df3d3 /lib/CodeGen/OptimizeExts.cpp
parent656bb20d61c38966246fbe94afa68f2045841e34 (diff)
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
Diffstat (limited to 'lib/CodeGen/OptimizeExts.cpp')
-rw-r--r--lib/CodeGen/OptimizeExts.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/OptimizeExts.cpp b/lib/CodeGen/OptimizeExts.cpp
index 844eb232f6..625ff89f90 100644
--- a/lib/CodeGen/OptimizeExts.cpp
+++ b/lib/CodeGen/OptimizeExts.cpp
@@ -110,6 +110,11 @@ bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
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 @@ bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB,
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