@@ -4150,7 +4150,7 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
4150
4150
GenTree* ptrToSpan = impPopStack().val;
4151
4151
GenTree* indexClone = nullptr;
4152
4152
GenTree* ptrToSpanClone = nullptr;
4153
- assert(varTypeIsIntegral (index));
4153
+ assert(genActualType (index) == TYP_INT );
4154
4154
assert(ptrToSpan->TypeGet() == TYP_BYREF);
4155
4155
4156
4156
#if defined(DEBUG)
@@ -4177,12 +4177,25 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
4177
4177
GenTreeBoundsChk(GT_ARR_BOUNDS_CHECK, TYP_VOID, index, length, SCK_RNGCHK_FAIL);
4178
4178
4179
4179
// Element access
4180
- index = impImplicitIorI4Cast(indexClone, TYP_I_IMPL);
4180
+ index = indexClone;
4181
+
4182
+ #ifdef TARGET_64BIT
4183
+ if (index->OperGet() == GT_CNS_INT)
4184
+ {
4185
+ index->gtType = TYP_I_IMPL;
4186
+ }
4187
+ else
4188
+ {
4189
+ index = gtNewCastNode(TYP_I_IMPL, index, true, TYP_I_IMPL);
4190
+ }
4191
+ #endif
4192
+
4181
4193
if (elemSize != 1)
4182
4194
{
4183
4195
GenTree* sizeofNode = gtNewIconNode(elemSize);
4184
4196
index = gtNewOperNode(GT_MUL, TYP_I_IMPL, index, sizeofNode);
4185
4197
}
4198
+
4186
4199
CORINFO_FIELD_HANDLE ptrHnd = info.compCompHnd->getFieldInClass(clsHnd, 0);
4187
4200
const unsigned ptrOffset = info.compCompHnd->getFieldOffset(ptrHnd);
4188
4201
GenTree* data = gtNewFieldRef(TYP_BYREF, ptrHnd, ptrToSpanClone, ptrOffset);
0 commit comments