File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -334,14 +334,18 @@ let destruct_pattern (body : Lam.t) params args =
334334
335335(* * Hints to inlining *)
336336let ok_to_inline_fun_when_app
337- ~(body : Lam.t )
338- (params : Ident.t list )
337+ (m : Lam.lfunction )
339338 (args : Lam.t list ) =
340- let s = size body in
341- s < small_inline_size ||
342- (destruct_pattern body params args) ||
343- (args_all_const args &&
344- (s < 10 && no_side_effects body ))
339+ match m.attr with
340+ | Always_inline -> true
341+ | Never_inline -> false
342+ | Default_inline ->
343+ let Lam. {body; params} = m in
344+ let s = size body in
345+ s < small_inline_size ||
346+ (destruct_pattern body params args) ||
347+ (args_all_const args &&
348+ (s < 10 && no_side_effects body ))
345349
346350
347351
Original file line number Diff line number Diff line change @@ -34,7 +34,10 @@ val no_side_effects : Lam.t -> bool
3434
3535val size : Lam .t -> int
3636
37- val ok_to_inline_fun_when_app : body :Lam .t -> Lam .ident list -> Lam .t list -> bool
37+ val ok_to_inline_fun_when_app :
38+ Lam .lfunction ->
39+ Lam .t list ->
40+ bool
3841
3942
4043
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ let simplify_alias
155155 let normal () = Lam. apply ( simpl fn) (Ext_list. map args simpl) loc status in
156156 begin
157157 match Hash_ident. find_opt meta.ident_tbl v with
158- | Some (FunctionId {lambda = Some (Lfunction {params; body} as _m ,
158+ | Some (FunctionId {lambda = Some (Lfunction ( {params; body} as m) ,
159159 rec_flag)
160160 })
161161 ->
@@ -177,7 +177,7 @@ let simplify_alias
177177 end
178178 else
179179 if (* Lam_analysis.size body < Lam_analysis.small_inline_size *)
180- Lam_analysis. ok_to_inline_fun_when_app ~body params args
180+ Lam_analysis. ok_to_inline_fun_when_app m args
181181 then
182182
183183 (* let param_map = *)
You can’t perform that action at this time.
0 commit comments