Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix gtCloneExpr when cloning during R2R compilation a GT_ALLOCOBJ nod…
…e - 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
  • Loading branch information
davidwrighton authored and github-actions committed Sep 21, 2021
commit ac111b55853e4c98e5b9386ff1eab943361ddb9a
4 changes: 4 additions & 0 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
copy->AsAllocObj()->gtEntryPoint = asAllocObj->gtEntryPoint;
#endif
}
break;

Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/objectalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ 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;
Expand Down