Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couple tweaks to optRemoveRedundantZeroInits #102531

Merged
merged 2 commits into from
May 22, 2024
Merged
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
14 changes: 10 additions & 4 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5918,7 +5918,12 @@ void Compiler::optRemoveRedundantZeroInits()
{
if (((tree->gtFlags & GTF_CALL) != 0))
{
hasGCSafePoint = true;
// if this is not a No-GC heleper
VSadov marked this conversation as resolved.
Show resolved Hide resolved
if (!tree->IsCall() || !emitter::emitNoGChelper(tree->AsCall()->GetHelperNum()))
{
// assume that we have a safe point.
hasGCSafePoint = true;
}
}

hasImplicitControlFlow |= hasEHSuccs && ((tree->gtFlags & GTF_EXCEPT) != 0);
Expand Down Expand Up @@ -6071,9 +6076,10 @@ void Compiler::optRemoveRedundantZeroInits()
(!hasImplicitControlFlow || (lclDsc->lvTracked && !lclDsc->lvLiveInOutOfHndlr)))
{
// If compMethodRequiresPInvokeFrame() returns true, lower may later
// insert a call to CORINFO_HELP_INIT_PINVOKE_FRAME which is a gc-safe point.
if (!lclDsc->HasGCPtr() ||
(!GetInterruptible() && !hasGCSafePoint && !compMethodRequiresPInvokeFrame()))
// insert a call to CORINFO_HELP_INIT_PINVOKE_FRAME but that is not a gc-safe point.
assert(emitter::emitNoGChelper(CORINFO_HELP_INIT_PINVOKE_FRAME));

if (!lclDsc->HasGCPtr() || (!GetInterruptible() && !hasGCSafePoint))
{
// The local hasn't been used and won't be reported to the gc between
// the prolog and this explicit initialization. Therefore, it doesn't
Expand Down