Skip to content

Commit

Permalink
JIT: Add a pass of liveness for the new locals inside physical promot…
Browse files Browse the repository at this point in the history
…ion (#86043)

Used when decomposing stores to skip the fields that are dying and the remainder if it is dying. Also allows forward sub to kick in for the inserted replacement locals.
  • Loading branch information
jakobbotsch committed May 19, 2023
1 parent 335f2ef commit e62cb64
Show file tree
Hide file tree
Showing 8 changed files with 1,811 additions and 493 deletions.
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
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

0 comments on commit e62cb64

Please sign in to comment.