Skip to content

Commit d6547a3

Browse files
Fix VN logic for zero-init
(The "lvaIsOSRLocal" check in codegen was redundant)
1 parent 553906f commit d6547a3

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

src/coreclr/jit/codegencommon.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,13 +4260,6 @@ void CodeGen::genCheckUseBlockInit()
42604260
continue;
42614261
}
42624262

4263-
// Initialization of OSR locals must be handled specially
4264-
if (compiler->lvaIsOSRLocal(varNum))
4265-
{
4266-
varDsc->lvMustInit = 0;
4267-
continue;
4268-
}
4269-
42704263
if (compiler->fgVarIsNeverZeroInitializedInProlog(varNum))
42714264
{
42724265
varDsc->lvMustInit = 0;

src/coreclr/jit/valuenum.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7581,18 +7581,9 @@ PhaseStatus Compiler::fgValueNumber()
75817581
// The last clause covers the use-before-def variables (the ones that are live-in to the first block),
75827582
// these are variables that are read before being initialized (at least on some control flow paths)
75837583
// if they are not must-init, then they get VNF_InitVal(i), as with the param case.)
7584-
7585-
bool isZeroed = (info.compInitMem || varDsc->lvMustInit);
7586-
7587-
// For OSR, locals or promoted fields of locals may be missing the initial def
7588-
// because of partial importation. We can't assume they are zero.
7589-
if (lvaIsOSRLocal(lclNum))
7590-
{
7591-
isZeroed = false;
7592-
}
7593-
7594-
ValueNum initVal = ValueNumStore::NoVN; // We must assign a new value to initVal
7595-
var_types typ = varDsc->TypeGet();
7584+
bool isZeroed = !fgVarNeedsExplicitZeroInit(lclNum, /* bbInALoop */ false, /* bbIsReturn */ false);
7585+
ValueNum initVal = ValueNumStore::NoVN; // We must assign a new value to initVal
7586+
var_types typ = varDsc->TypeGet();
75967587

75977588
switch (typ)
75987589
{

0 commit comments

Comments
 (0)