Skip to content

Commit

Permalink
Try a hack to see if the diffs are better
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalPetryka committed Jul 26, 2022
1 parent b7e6d4e commit 7af6e18
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3883,22 +3883,16 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
{
assert(sig->numArgs == 1);

GenTree* array = impPopStack().val;
CORINFO_CLASS_HANDLE elemHnd = sig->sigInst.methInst[0];
CorInfoType jitType = info.compCompHnd->asCorInfoType(elemHnd);
var_types elemType = JITtype2varType(jitType);
GenTree* array = impPopStack().val;

GenTree* arrayClone;
array = impCloneExpr(array, &arrayClone, NO_CLASS_HANDLE, (unsigned)CHECK_SPILL_ALL,
nullptr DEBUGARG("MemoryMarshal.GetArrayDataReference array"));

impAppendTree(gtNewNullCheck(arrayClone, compCurBB), (unsigned)CHECK_SPILL_ALL, impCurStmtDI);

GenTree* index = gtNewIconNode(0, TYP_I_IMPL);
GenTreeIndexAddr* indexAddr = gtNewArrayIndexAddr(array, index, elemType, elemHnd);
indexAddr->gtFlags &= ~GTF_INX_RNGCHK;
indexAddr->gtFlags |= GTF_INX_ADDR_NONNULL;
retNode = indexAddr;
GenTree* offset = gtNewIconNode(OFFSETOF__CORINFO_Array__data, TYP_I_IMPL);
retNode = gtNewOperNode(GT_ADD, TYP_BYREF, array, offset);
break;
}

Expand Down

0 comments on commit 7af6e18

Please sign in to comment.