Skip to content

[LiveIntervals] repairIntervalsInRange: recompute width changes #78564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions llvm/lib/CodeGen/LiveIntervals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1666,13 +1666,27 @@ LiveIntervals::repairIntervalsInRange(MachineBasicBlock *MBB,
for (const MachineOperand &MO : MI.operands()) {
if (MO.isReg() && MO.getReg().isVirtual()) {
Register Reg = MO.getReg();
// If the new instructions refer to subregs but the old instructions did
// not, throw away any old live interval so it will be recomputed with
// subranges.
if (MO.getSubReg() && hasInterval(Reg) &&
!getInterval(Reg).hasSubRanges() &&
MRI->shouldTrackSubRegLiveness(Reg))
removeInterval(Reg);
MRI->shouldTrackSubRegLiveness(Reg)) {
LiveInterval &LI = getInterval(Reg);
if (!LI.hasSubRanges()) {
// If the new instructions refer to subregs but the old instructions
// did not, throw away any old live interval so it will be
// recomputed with subranges.
removeInterval(Reg);
} else if (MO.isDef()) {
// Similarly if a subreg def has no precise subrange match then
// assume we need to recompute all subranges.
unsigned SubReg = MO.getSubReg();
LaneBitmask Mask = TRI->getSubRegIndexLaneMask(SubReg);
if (llvm::none_of(LI.subranges(),
[Mask](LiveInterval::SubRange &SR) {
return SR.LaneMask == Mask;
})) {
removeInterval(Reg);
}
}
}
if (!hasInterval(Reg)) {
createAndComputeVirtRegInterval(Reg);
// Don't bother to repair a freshly calculated live interval.
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/lds-misaligned-bug.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
; RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -mattr=+cumode,+unaligned-access-mode < %s | FileCheck -check-prefixes=GCN,UNALIGNED,VECT %s
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,ALIGNED,VECT %s
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -mattr=+cumode < %s | FileCheck -check-prefixes=GCN,ALIGNED,VECT %s
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -mattr=+cumode -early-live-intervals < %s | FileCheck -check-prefixes=GCN,ALIGNED,VECT %s
; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -mattr=+cumode,+unaligned-access-mode < %s | FileCheck -check-prefixes=GCN,UNALIGNED,VECT %s

; GCN-LABEL: test_local_misaligned_v2:
Expand Down