Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 4f6fe87

Browse files
authored
Fix issue #11446. (#11455)
This issue was a GC hole that was caused by bad IR produced by recursivelty promoting a struct with the following form: ``` struct S { struct T { object o; }; T t; } ``` In this case, the recursive promotion logic created a single lclVar to represent `S.t` and retyped it using the type of `T.o`, but did not rewrite IR that treated the single lclVar as a struct (e.g. instances of `lclFld/st.lclFld Vx` where `Vx` referred to the lclVar that represented `S.t` were not rewritten an `lclVar/st.lclVar Vx`). This IR in turn confused the incremental liveness used during code generation, which caused the stack slot holding `o`'s value to die too early. This change fixes codegen's incremental liveness to handle this case.
1 parent ce327d5 commit 4f6fe87

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/jit/codegenlinear.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ void CodeGen::genConsumeRegs(GenTree* tree)
12281228
genConsumeAddress(tree->AsIndir()->Addr());
12291229
}
12301230
#ifdef _TARGET_XARCH_
1231-
else if (tree->OperGet() == GT_LCL_VAR)
1231+
else if (tree->OperIsLocalRead())
12321232
{
12331233
// A contained lcl var must be living on stack and marked as reg optional, or not be a
12341234
// register candidate.

src/jit/codegenxarch.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
15581558
GenTreePtr op1 = treeNode->gtGetOp1();
15591559
genConsumeRegs(op1);
15601560
emit->emitInsBinary(ins_Store(targetType), emitTypeSize(treeNode), treeNode, op1);
1561+
1562+
genUpdateLife(treeNode);
15611563
}
15621564
break;
15631565

0 commit comments

Comments
 (0)