diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 22e46b6a819eb2..d06b00a9d4d4e0 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -7475,6 +7475,7 @@ GenTreeAllocObj* Compiler::gtNewAllocObjNode(CORINFO_RESOLVED_TOKEN* pResolvedTo #ifdef FEATURE_READYTORUN_COMPILER if (usingReadyToRunHelper) { + assert(lookup.addr != nullptr); allocObj->gtEntryPoint = lookup; } #endif @@ -7879,6 +7880,9 @@ GenTree* Compiler::gtCloneExpr( copy = new (this, GT_ALLOCOBJ) GenTreeAllocObj(tree->TypeGet(), asAllocObj->gtNewHelper, asAllocObj->gtHelperHasSideEffects, asAllocObj->gtAllocObjClsHnd, asAllocObj->gtOp1); +#ifdef FEATURE_READYTORUN_COMPILER + copy->AsAllocObj()->gtEntryPoint = asAllocObj->gtEntryPoint; +#endif } break; diff --git a/src/coreclr/jit/objectalloc.cpp b/src/coreclr/jit/objectalloc.cpp index 720ec2585c4d61..0d21c1ab6104db 100644 --- a/src/coreclr/jit/objectalloc.cpp +++ b/src/coreclr/jit/objectalloc.cpp @@ -481,6 +481,11 @@ GenTree* ObjectAllocator::MorphAllocObjNodeIntoHelperCall(GenTreeAllocObj* alloc assert(comp->opts.IsReadyToRun()); helperCall->AsCall()->setEntryPoint(entryPoint); } + else + { + assert(helper != CORINFO_HELP_READYTORUN_NEW); // If this is true, then we should have collected a non-null + // entrypoint above + } #endif return helperCall;