[llvm] [AMDGPU][SplitKit] Remove uses in blocks not covered by the live interval (PR #177270)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 28 03:53:54 PST 2026
================
@@ -173,14 +173,31 @@ void SplitAnalysis::analyzeUses() {
if (!VNI->isPHIDef() && !VNI->isUnused())
UseSlots.push_back(VNI->def);
- // Get use slots form the use-def chain.
+ // Get use slots from the use-def chain.
const MachineRegisterInfo &MRI = MF.getRegInfo();
for (MachineOperand &MO : MRI.use_nodbg_operands(CurLI->reg()))
if (!MO.isUndef())
UseSlots.push_back(LIS.getInstructionIndex(*MO.getParent()).getRegSlot());
array_pod_sort(UseSlots.begin(), UseSlots.end());
+ // Remove uses in blocks not covered by the live interval. This can happen
+ // during register allocation when the live interval is shrunk (e.g., due to
+ // dead PHI elimination) after spill code has been inserted. The spill
+ // instructions create uses that remain in the use-def chain until they are
+ // later deleted, but the live interval no longer covers those blocks.
+ if (!CurLI->empty()) {
+ UseSlots.erase(std::remove_if(UseSlots.begin(), UseSlots.end(),
----------------
MrSidims wrote:
Applied, thanks!
https://github.com/llvm/llvm-project/pull/177270
More information about the llvm-commits
mailing list