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 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
7 changes: 7 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 @@ -534,6 +535,12 @@ bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
InitializeSlots();
Changed = ColorSlots(MF);

// Clear LiveStack analysis as it has been changed in ways that it requires
// efforts to rectify which is equivalent to do it all over again. Also,
// this current results would not be used later, so better to clear it &
// preserve analysis.
LS->releaseMemory();
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're just going to throw away the result there's no point in claiming this is preserved, since it's a lie

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But, currently LiveStack analysis really is doing nothing just creating a empty shell result, & real work is happening at RA to compute and update livestack result. Also, once generated at RA pass, spill entries in LS will later be used at stackSlotColoring pass, followed by not being used ever again (LS later be used during SCC pass coming after later RA passes, but at that point RA is concerned with newly introduced spill records in LS by itself). So, my point is that preserving LS won't help out in any way. And LS analyis itself is doing no computation, so its re-occurence should not have impact on performance.


for (int &Next : NextColors)
Next = -1;

Expand Down
Loading