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

JIT: Add a pass of liveness for the new locals inside physical promotion #86043

Merged
merged 18 commits into from
May 19, 2023
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
1 change: 1 addition & 0 deletions src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ set( JIT_SOURCES
phase.cpp
promotion.cpp
promotiondecomposition.cpp
promotionliveness.cpp
rangecheck.cpp
rationalize.cpp
redundantbranchopts.cpp
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ class LclVarDsc
{
return lvTracked && lvType != TYP_STRUCT;
}
#ifdef DEBUG
unsigned char lvTrackedWithoutIndex : 1; // Tracked but has no lvVarIndex (i.e. only valid GTF_VAR_DEATH flags, used
// by physical promotion)
#endif
Comment on lines +516 to +519
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just used to print "(last use)" in the dump outside the new locals introduced by physical promotion.

unsigned char lvPinned : 1; // is this a pinned variable?

unsigned char lvMustInit : 1; // must be initialized
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11936,7 +11936,6 @@ void Compiler::gtDispLocal(GenTreeLclVarCommon* tree, IndentStack* indentStack)
printf(" ");
fieldVarDsc->PrintVarReg();
}

if (fieldVarDsc->lvTracked && fgLocalVarLivenessDone && tree->IsLastUse(index))
{
printf(" (last use)");
Expand All @@ -11946,7 +11945,8 @@ void Compiler::gtDispLocal(GenTreeLclVarCommon* tree, IndentStack* indentStack)
}
else // a normal not-promoted lclvar
{
if (varDsc->lvTracked && fgLocalVarLivenessDone && ((tree->gtFlags & GTF_VAR_DEATH) != 0))
if ((varDsc->lvTracked || varDsc->lvTrackedWithoutIndex) && fgLocalVarLivenessDone &&
((tree->gtFlags & GTF_VAR_DEATH) != 0))
{
printf(" (last use)");
}
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3564,6 +3564,7 @@ void Compiler::lvaSortByRefCount()

// Start by assuming that the variable will be tracked.
varDsc->lvTracked = 1;
INDEBUG(varDsc->lvTrackedWithoutIndex = 0);

if (varDsc->lvRefCnt(lvaRefCountState) == 0)
{
Expand Down
Loading