Skip to content
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

[CodeGen] Preserve LiveStack analysis in StackSlotColoring pass #94967

Closed
Closed
Changes from 1 commit
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
18 changes: 18 additions & 0 deletions llvm/lib/CodeGen/StackSlotColoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ namespace {
AU.addRequired<SlotIndexes>();
AU.addPreserved<SlotIndexes>();
AU.addRequired<LiveStacks>();
AU.addPreserved<LiveStacks>();
AU.addRequired<MachineBlockFrequencyInfo>();
AU.addPreserved<MachineBlockFrequencyInfo>();
AU.addPreservedID(MachineDominatorsID);
Expand Down Expand Up @@ -411,6 +412,23 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
}
}

// In order to preserve LiveStack analysis, the live ranges for dead spill
// stack slots would be merged with the live range of those stack slots that
// now share the spill object of the mentioned dead stack slot.
for (unsigned SS = 0, SE = SlotMapping.size(); SS != SE; ++SS) {
int NewFI = SlotMapping[SS];
if (SlotMapping[SS] == -1 || (NewFI == (int)SS)) {
continue;
}

LiveRange &lrToUpdateInto =
static_cast<LiveRange &>(LS->getInterval(NewFI));
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't need this cast?

const LiveRange &lrToUpdateFrom =
static_cast<LiveRange &>(LS->getInterval((int)SS));
lrToUpdateInto.MergeSegmentsInAsValue(lrToUpdateFrom,
lrToUpdateInto.getValNumInfo(0));
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use join.

}

return true;
}

Expand Down
Loading