From 72b9deb21f12469d025e96fdb9af6aa316f96a47 Mon Sep 17 00:00:00 2001 From: Markus Lavin Date: Thu, 3 Jan 2019 08:36:06 +0000 Subject: [CodeGen] Skip over dbg-instr in twoaddr pass A DBG_VALUE between a two-address instruction and a following COPY would prevent rescheduleMIBelowKill optimization inside TwoAddressInstructionPass. Differential Revision: https://reviews.llvm.org/D55987 llvm-svn: 350289 --- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp') diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index 2e2fe72e539..4b72f6a84ca 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -929,9 +929,12 @@ rescheduleMIBelowKill(MachineBasicBlock::iterator &mi, MachineBasicBlock::iterator Begin = MI; MachineBasicBlock::iterator AfterMI = std::next(Begin); MachineBasicBlock::iterator End = AfterMI; - while (End->isCopy() && - regOverlapsSet(Defs, End->getOperand(1).getReg(), TRI)) { - Defs.push_back(End->getOperand(0).getReg()); + while (End != MBB->end()) { + End = skipDebugInstructionsForward(End, MBB->end()); + if (End->isCopy() && regOverlapsSet(Defs, End->getOperand(1).getReg(), TRI)) + Defs.push_back(End->getOperand(0).getReg()); + else + break; ++End; } -- cgit v1.2.3