aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineSink.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2024-02-15 10:39:05 +0000
committerGitHub <noreply@github.com>2024-02-15 10:39:05 +0000
commit2df652a69159b76c97cfd94e32ad6bb71dde716c (patch)
tree10643c6a1b84177d1dab4d47e6a8980d63937482 /llvm/lib/CodeGen/MachineSink.cpp
parent97c19a46cd177b19667a65db8720e92ff91c7b2e (diff)
downloadllvm-2df652a69159b76c97cfd94e32ad6bb71dde716c.zip
llvm-2df652a69159b76c97cfd94e32ad6bb71dde716c.tar.gz
llvm-2df652a69159b76c97cfd94e32ad6bb71dde716c.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineSink.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineSink.cpp9
1 files changed, 2 insertions, 7 deletions
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();
}