Skip to content

Commit 0a68428

Browse files
authored
Do not mark implicit byrefs with GTF_GLOB_REF (dotnet#66266)
1 parent a0a5fc9 commit 0a68428

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

src/coreclr/jit/compiler.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,14 +1114,6 @@ inline GenTreeField* Compiler::gtNewFieldRef(var_types type, CORINFO_FIELD_HANDL
11141114
LclVarDsc* varDsc = lvaGetDesc(obj->AsUnOp()->gtOp1->AsLclVarCommon());
11151115

11161116
varDsc->lvFieldAccessed = 1;
1117-
#if defined(TARGET_AMD64) || defined(TARGET_ARM64)
1118-
// These structs are passed by reference; we should probably be able to treat these
1119-
// as non-global refs, but downstream logic expects these to be marked this way.
1120-
if (varDsc->lvIsParam)
1121-
{
1122-
fieldNode->gtFlags |= GTF_GLOB_REF;
1123-
}
1124-
#endif // defined(TARGET_AMD64) || defined(TARGET_ARM64)
11251117
}
11261118
else
11271119
{

src/coreclr/jit/morph.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5896,8 +5896,9 @@ GenTree* Compiler::fgMorphField(GenTree* tree, MorphAddrContext* mac)
58965896
fgMorphImplicitByRefArgs(objRef);
58975897
}
58985898

5899-
noway_assert(((objRef != nullptr) && (objRef->IsLocalAddrExpr() != nullptr)) ||
5900-
((tree->gtFlags & GTF_GLOB_REF) != 0));
5899+
noway_assert(((objRef != nullptr) && ((objRef->IsLocalAddrExpr() != nullptr) ||
5900+
(objRef->IsImplicitByrefParameterValue(this) != nullptr))) ||
5901+
(tree->gtFlags & GTF_GLOB_REF) != 0);
59015902

59025903
if (tree->AsField()->gtFldMayOverlap)
59035904
{

0 commit comments

Comments
 (0)