Skip to content

Commit cd8cb89

Browse files
authored
Fix layouts in flambda1 partial application simplification (#1549)
* Fix layouts in flambda1 partial application simplification * add back assert
1 parent 6739d76 commit cd8cb89

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

middle_end/flambda/inline_and_simplify.ml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -777,10 +777,13 @@ and simplify_apply env r ~(apply : Flambda.apply) : Flambda.t * R.t =
777777
~function_decls ~lhs_of_application ~closure_id_being_applied
778778
~function_decl ~value_set_of_closures ~dbg ~reg_close ~mode
779779
~inlined_requested ~specialise_requested ~result_layout
780-
else if nargs > 0 && nargs < arity then
780+
else if nargs > 0 && nargs < arity then begin
781+
assert(Lambda.compatible_layout Lambda.layout_function
782+
result_layout);
781783
simplify_partial_application env r ~lhs_of_application
782784
~closure_id_being_applied ~function_decl ~args ~mode ~dbg
783-
~inlined_requested ~specialise_requested ~result_layout
785+
~inlined_requested ~specialise_requested
786+
end
784787
else
785788
Misc.fatal_errorf "Function with arity %d when simplifying \
786789
application expression: %a"
@@ -809,7 +812,7 @@ and simplify_full_application env r ~function_decls ~lhs_of_application
809812

810813
and simplify_partial_application env r ~lhs_of_application
811814
~closure_id_being_applied ~function_decl ~args ~mode ~dbg
812-
~inlined_requested ~specialise_requested ~result_layout
815+
~inlined_requested ~specialise_requested
813816
=
814817
let arity = A.function_arity function_decl in
815818
assert (arity > List.length args);
@@ -867,10 +870,9 @@ and simplify_partial_application env r ~lhs_of_application
867870
inlined = Default_inlined;
868871
specialise = Default_specialise;
869872
probe = None;
870-
result_layout;
873+
result_layout = function_decl.A.return_layout;
871874
}
872875
in
873-
assert(Lambda.compatible_layout function_decl.A.return_layout result_layout);
874876
let closure_variable =
875877
Variable.rename ~debug_info:(Closure_id.debug_info closure_id_being_applied)
876878
(Closure_id.unwrap closure_id_being_applied)

0 commit comments

Comments
 (0)