Skip to content

Fix layouts in flambda1 partial application simplification #1549

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

Merged
merged 2 commits into from
Jul 12, 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: 7 additions & 5 deletions middle_end/flambda/inline_and_simplify.ml
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,13 @@ and simplify_apply env r ~(apply : Flambda.apply) : Flambda.t * R.t =
~function_decls ~lhs_of_application ~closure_id_being_applied
~function_decl ~value_set_of_closures ~dbg ~reg_close ~mode
~inlined_requested ~specialise_requested ~result_layout
else if nargs > 0 && nargs < arity then
else if nargs > 0 && nargs < arity then begin
assert(Lambda.compatible_layout Lambda.layout_function
result_layout);
simplify_partial_application env r ~lhs_of_application
~closure_id_being_applied ~function_decl ~args ~mode ~dbg
~inlined_requested ~specialise_requested ~result_layout
~inlined_requested ~specialise_requested
end
else
Misc.fatal_errorf "Function with arity %d when simplifying \
application expression: %a"
Expand Down Expand Up @@ -809,7 +812,7 @@ and simplify_full_application env r ~function_decls ~lhs_of_application

and simplify_partial_application env r ~lhs_of_application
~closure_id_being_applied ~function_decl ~args ~mode ~dbg
~inlined_requested ~specialise_requested ~result_layout
~inlined_requested ~specialise_requested
=
let arity = A.function_arity function_decl in
assert (arity > List.length args);
Expand Down Expand Up @@ -867,10 +870,9 @@ and simplify_partial_application env r ~lhs_of_application
inlined = Default_inlined;
specialise = Default_specialise;
probe = None;
result_layout;
result_layout = function_decl.A.return_layout;
}
in
assert(Lambda.compatible_layout function_decl.A.return_layout result_layout);
let closure_variable =
Variable.rename ~debug_info:(Closure_id.debug_info closure_id_being_applied)
(Closure_id.unwrap closure_id_being_applied)
Expand Down