File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1241,18 +1241,21 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>
12411241 break ;
12421242
12431243 case GT_CAST:
1244+ {
12441245 assert (TopValue (1 ).Node () == node);
12451246 assert (TopValue (0 ).Node () == node->AsCast ()->CastOp ());
12461247
1247- if (!node->TypeIs (TYP_I_IMPL, TYP_BYREF) || node->gtOverflow () || !TopValue (0 ).IsAddress () ||
1248+ var_types castToType = node->CastToType ();
1249+ bool isPtrCast = (castToType == TYP_I_IMPL) || (castToType == TYP_U_IMPL) || (castToType == TYP_BYREF);
1250+ if (!isPtrCast || node->gtOverflow () || !TopValue (0 ).IsAddress () ||
12481251 !TopValue (1 ).AddOffset (TopValue (0 ), 0 ))
12491252 {
12501253 EscapeValue (TopValue (0 ), node);
12511254 }
12521255
12531256 PopValue ();
12541257 break ;
1255-
1258+ }
12561259 case GT_CALL:
12571260 while (TopValue (0 ).Node () != node)
12581261 {
You can’t perform that action at this time.
0 commit comments