* Fix gtCloneExpr when cloning during R2R compilation a GT_ALLOCOBJ node
- Without this fix cloned expressions with allocations will fail
- This is most common in profile guided code around devirtualization, but I believe it can occur in other where gtCloneExpr is used
- Symptom of the failure is a compilation failure during crossgen2
#ifdef FEATURE_READYTORUN
if (usingReadyToRunHelper)
{
+ assert(lookup.addr != nullptr);
allocObj->gtEntryPoint = lookup;
}
#endif
copy = new (this, GT_ALLOCOBJ)
GenTreeAllocObj(tree->TypeGet(), asAllocObj->gtNewHelper, asAllocObj->gtHelperHasSideEffects,
asAllocObj->gtAllocObjClsHnd, asAllocObj->gtOp1);
+#ifdef FEATURE_READYTORUN
+ copy->AsAllocObj()->gtEntryPoint = asAllocObj->gtEntryPoint;
+#endif
}
break;
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;