Skip to content

Commit eb8d5f7

Browse files
authored
JIT: Allow cloning addresses even before initobj (#79341)
Roslyn emits ldloca + dup + initobj when initializing structs. Normally we clone address trees instead of creating a local for them (which will address expose the local), but we treat this initobj pattern specially. Remove this special treatment. It means we sometimes end up with slightly larger code because we no longer have a register with the address in it (could potentially be fixed by CSE), but avoiding the address exposure seems like the right trade off to me. Fix #42354 Fix #57055
1 parent 8767b38 commit eb8d5f7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/coreclr/jit/importer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8387,8 +8387,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
83878387
{
83888388
clone = true;
83898389
}
8390-
else if (op1->TypeIs(TYP_BYREF, TYP_I_IMPL) && impIsAddressInLocal(op1) &&
8391-
(OPCODE)impGetNonPrefixOpcode(codeAddr + sz, codeEndp) != CEE_INITOBJ)
8390+
else if (op1->TypeIs(TYP_BYREF, TYP_I_IMPL) && impIsAddressInLocal(op1))
83928391
{
83938392
// We mark implicit byrefs with GTF_GLOB_REF (see gtNewFieldRef for why).
83948393
// Avoid cloning for these.

0 commit comments

Comments
 (0)