summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PeepholeOptimizer.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2012-02-25 02:01:00 +0000
committerLang Hames <lhames@gmail.com>2012-02-25 02:01:00 +0000
commitc69cbd0a7431b047dbc4a9758e81bf122926ba0a (patch)
treed63e9986ada59a2a1a98fe90400311d20334be9b /lib/CodeGen/PeepholeOptimizer.cpp
parentff16eb64f5248df439a7b006f4aefd470606287a (diff)
downloadllvm-c69cbd0a7431b047dbc4a9758e81bf122926ba0a.tar.gz
llvm-c69cbd0a7431b047dbc4a9758e81bf122926ba0a.tar.bz2
llvm-c69cbd0a7431b047dbc4a9758e81bf122926ba0a.tar.xz
Make the peephole optimizer clear kill flags on a vreg if it's about to add new
uses of the vreg, since the old kills may no longer be valid. This was causing -verify-machineinstrs to complain about uses after kills, and could potentially have been causing subtle register allocation issues, but I haven't come across a test case yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PeepholeOptimizer.cpp')
-rw-r--r--lib/CodeGen/PeepholeOptimizer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp
index 203f2bffb7..9c5c029000 100644
--- a/lib/CodeGen/PeepholeOptimizer.cpp
+++ b/lib/CodeGen/PeepholeOptimizer.cpp
@@ -237,6 +237,10 @@ OptimizeExtInstr(MachineInstr *MI, MachineBasicBlock *MBB,
if (PHIBBs.count(UseMBB))
continue;
+ // About to add uses of DstReg, clear DstReg's kill flags.
+ if (!Changed)
+ MRI->clearKillFlags(DstReg);
+
unsigned NewVR = MRI->createVirtualRegister(RC);
BuildMI(*UseMBB, UseMI, UseMI->getDebugLoc(),
TII->get(TargetOpcode::COPY), NewVR)