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

[mono][interp] Reduce redundant moves with calls #79905

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Changes from all commits
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
12 changes: 5 additions & 7 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -9187,11 +9187,6 @@ interp_cprop (TransformData *td)
}
} else {
cprop_sreg (td, ins, &sregs [i], local_defs);
// This var is used as a source to a normal instruction. In case this var will
// also be used as source to a call, make sure the offset allocator will create
// a new temporary call arg var and not use this one. Call arg vars have special
// semantics. They can be assigned only once and they die once the call is made.
td->locals [sregs [i]].flags |= INTERP_LOCAL_FLAG_NO_CALL_ARGS;
}
}

Expand Down Expand Up @@ -10395,9 +10390,12 @@ interp_alloc_offsets (TransformData *td)

while (var != -1) {
if (td->locals [var].flags & INTERP_LOCAL_FLAG_GLOBAL ||
!td->local_ref_count || td->local_ref_count [var] > 1 ||
td->locals [var].flags & INTERP_LOCAL_FLAG_NO_CALL_ARGS) {
// A global var is an argument to a call, which is not allowed. We need
// to copy the global var into a local var
// Some vars can't be allocated on the call args stack, since the constraint is that
// call args vars die after the call. This isn't necessarily true for global vars or
// vars that are used by other instructions aside from the call.
// We need to copy the var into a new tmp var
int new_var = create_interp_local (td, td->locals [var].type);
td->locals [new_var].call = ins;
td->locals [new_var].flags |= INTERP_LOCAL_FLAG_CALL_ARGS;
Expand Down