From 5136f4748a2b3302da581f6140ca453bb37f11e9 Mon Sep 17 00:00:00 2001 From: Carl Ritson Date: Fri, 2 Oct 2020 09:58:36 +0900 Subject: CodeGen: Fix livein calculation in MachineBasicBlock splitAt Fix and simplify computation of liveins for new block. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D88535 --- llvm/lib/CodeGen/MachineBasicBlock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp') diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 8a37a1e..6272adc 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -961,9 +961,10 @@ MachineBasicBlock *MachineBasicBlock::splitAt(MachineInstr &MI, if (UpdateLiveIns) { // Make sure we add any physregs we define in the block as liveins to the // new block. + MachineBasicBlock::iterator Prev(&MI); LiveRegs.init(*MF->getSubtarget().getRegisterInfo()); LiveRegs.addLiveOuts(*this); - for (auto I = rbegin(), E = SplitPoint.getReverse(); I != E; ++I) + for (auto I = rbegin(), E = Prev.getReverse(); I != E; ++I) LiveRegs.stepBackward(*I); } -- cgit v1.1