Skip to content
Merged
Changes from 3 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
11 changes: 6 additions & 5 deletions llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,15 +482,16 @@ void AMDGPURewriteAGPRCopyMFMAImpl::eliminateSpillsOfReassignedVGPRs() const {
}

sort(StackIntervals, [](const LiveInterval *A, const LiveInterval *B) {
// The ordering have to be strictly weak.
/// Sort heaviest intervals first to prioritize their unspilling
if (A->weight() > B->weight())
return true;
if (A->weight() != B->weight())
return A->weight() > B->weight();

if (A->getSize() > B->getSize())
return true;
if (A->getSize() != B->getSize())
return A->getSize() > B->getSize();

// Tie breaker by number to avoid need for stable sort
return A->reg().stackSlotIndex() < B->reg().stackSlotIndex();
return (A->reg().stackSlotIndex() < B->reg().stackSlotIndex());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (A->reg().stackSlotIndex() < B->reg().stackSlotIndex());
return A->reg().stackSlotIndex() < B->reg().stackSlotIndex();

});

// FIXME: The APIs for dealing with the LiveInterval of a frame index are
Expand Down