Skip to content

Commit 5c1ba69

Browse files
authored
JIT: Handle byref<->nint casts on addresses in local morph (#117885)
1 parent cd4c7cf commit 5c1ba69

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/coreclr/jit/importer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13395,7 +13395,7 @@ void Compiler::impInlineRecordArgInfo(InlineInfo* pInlineInfo,
1339513395
// The method may make observations that lead to marking this candidate as
1339613396
// a failed inline. If this happens the initialization is abandoned immediately
1339713397
// to try and reduce the jit time cost for a failed inline.
13398-
13398+
//
1339913399
void Compiler::impInlineInitVars(InlineInfo* pInlineInfo)
1340013400
{
1340113401
assert(!compIsForInlining());

src/coreclr/jit/lclmorph.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,19 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>
12401240
PopValue();
12411241
break;
12421242

1243+
case GT_CAST:
1244+
assert(TopValue(1).Node() == node);
1245+
assert(TopValue(0).Node() == node->AsCast()->CastOp());
1246+
1247+
if (!node->TypeIs(TYP_I_IMPL, TYP_BYREF) || node->gtOverflow() || !TopValue(0).IsAddress() ||
1248+
!TopValue(1).AddOffset(TopValue(0), 0))
1249+
{
1250+
EscapeValue(TopValue(0), node);
1251+
}
1252+
1253+
PopValue();
1254+
break;
1255+
12431256
case GT_CALL:
12441257
while (TopValue(0).Node() != node)
12451258
{

0 commit comments

Comments
 (0)