From 4921d1af7dae8006e395dcfb46a35f0f5db6ee15 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Thu, 21 Aug 2014 21:34:06 +0000 Subject: [PATCH] [PeepholeOptimizer] Update the kill flags when extending the live-range of the source of a copy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216229 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/PeepholeOptimizer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/PeepholeOptimizer.cpp b/lib/CodeGen/PeepholeOptimizer.cpp index ae14331d663..98fcc2e2529 100644 --- a/lib/CodeGen/PeepholeOptimizer.cpp +++ b/lib/CodeGen/PeepholeOptimizer.cpp @@ -899,7 +899,11 @@ bool PeepholeOptimizer::optimizeCoalescableCopy(MachineInstr *MI) { if (!findNextSource(NewSrc, NewSubReg) || SrcReg == NewSrc) continue; // Rewrite source. - Changed |= CpyRewriter->RewriteCurrentSource(NewSrc, NewSubReg); + if (CpyRewriter->RewriteCurrentSource(NewSrc, NewSubReg)) { + // We may have extended the live-range of NewSrc, account for that. + MRI->clearKillFlags(NewSrc); + Changed = true; + } } // TODO: We could have a clean-up method to tidy the instruction. // E.g., v0 = INSERT_SUBREG v1, v1.sub0, sub0 -- 2.11.0