Skip to content

Commit 15f6d4e

Browse files
committed
DNER structs that are not of enregisterable size before lowering
1 parent f963186 commit 15f6d4e

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

src/coreclr/jit/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4194,7 +4194,7 @@ class Compiler
41944194
bool lvaVarDoNotEnregister(unsigned varNum);
41954195

41964196
void lvSetMinOptsDoNotEnreg();
4197-
void lvSetEHVarsDoNotEnreg();
4197+
void lvSetVarsDoNotEnreg();
41984198

41994199
bool lvaEnregEHVars;
42004200
bool lvaEnregMultiRegVars;

src/coreclr/jit/lclvars.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,11 +1339,11 @@ void Compiler::lvSetMinOptsDoNotEnreg()
13391339
}
13401340

13411341
//------------------------------------------------------------------------
1342-
// lvSetEHVarsDoNotEnreg:
1343-
// Set locals that we expect to not be enregisterable due to EH as DNER, to
1344-
// allow specific optimizations for these by lowering.
1342+
// lvSetVarsDoNotEnreg:
1343+
// Set locals that we expect to not be enregisterable as DNER, to allow
1344+
// specific optimizations for these by lowering.
13451345
//
1346-
void Compiler::lvSetEHVarsDoNotEnreg()
1346+
void Compiler::lvSetVarsDoNotEnreg()
13471347
{
13481348
for (unsigned lclNum = 0; lclNum < lvaCount; lclNum++)
13491349
{
@@ -1357,6 +1357,10 @@ void Compiler::lvSetEHVarsDoNotEnreg()
13571357
{
13581358
lvaSetVarDoNotEnregister(lclNum DEBUGARG(DoNotEnregisterReason::LiveInOutOfHandler));
13591359
}
1360+
else if (varTypeIsStruct(dsc) && !dsc->lvPromoted && !dsc->IsEnregisterableType())
1361+
{
1362+
lvaSetVarDoNotEnregister(lclNum DEBUGARG(DoNotEnregisterReason::NotRegSizeStruct));
1363+
}
13601364
}
13611365
}
13621366

src/coreclr/jit/lower.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8930,9 +8930,9 @@ PhaseStatus Lowering::DoPhase()
89308930
}
89318931
else
89328932
{
8933-
// By this point tracked locals live into EH clauses are _very_ likely to not be enregistered.
8934-
// DNER this for the same reason above, so that we can contain these locals.
8935-
m_compiler->lvSetEHVarsDoNotEnreg();
8933+
// For many locals we know at this point that we won't enregister them,
8934+
// so DNER these for the same reasons as above.
8935+
m_compiler->lvSetVarsDoNotEnreg();
89368936
}
89378937

89388938
if (m_compiler->opts.OptimizationEnabled() && !m_compiler->opts.IsOSR())

0 commit comments

Comments
 (0)