From 2df652a69159b76c97cfd94e32ad6bb71dde716c Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Thu, 15 Feb 2024 10:39:05 +0000 Subject: [CodeGen] Simplify updateLiveIn in MachineSink (#79831) When a whole register is added a basic block's liveins, use LaneBitmask::getAll for the live lanes instead of trying to calculate an accurate mask of the lanes that comprise the register. This simplifies the code and matches other places where a whole register is marked as livein. This also avoids problems when regunits that are synthesized by TableGen to represent ad hoc aliasing have a lane mask of 0. Fixes #78942 --- llvm/lib/CodeGen/MachineSink.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'llvm/lib/CodeGen/MachineSink.cpp') diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index e7e8f60..c3a1d37 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -1949,13 +1949,8 @@ static void updateLiveIn(MachineInstr *MI, MachineBasicBlock *SuccBB, for (unsigned DefReg : DefedRegsInCopy) for (MCPhysReg S : TRI->subregs_inclusive(DefReg)) SuccBB->removeLiveIn(S); - for (auto U : UsedOpsInCopy) { - Register SrcReg = MI->getOperand(U).getReg(); - LaneBitmask Mask; - for (MCRegUnitMaskIterator S(SrcReg, TRI); S.isValid(); ++S) - Mask |= (*S).second; - SuccBB->addLiveIn(SrcReg, Mask); - } + for (auto U : UsedOpsInCopy) + SuccBB->addLiveIn(MI->getOperand(U).getReg()); SuccBB->sortUniqueLiveIns(); } -- cgit v1.1