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 =
334
334
335
335
(* * Hints to inlining *)
336
336
let ok_to_inline_fun_when_app
337
- ~(body : Lam.t )
338
- (params : Ident.t list )
337
+ (m : Lam.lfunction )
339
338
(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 ))
345
349
346
350
347
351
Original file line number Diff line number Diff line change @@ -34,7 +34,10 @@ val no_side_effects : Lam.t -> bool
34
34
35
35
val size : Lam .t -> int
36
36
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
38
41
39
42
40
43
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ let simplify_alias
155
155
let normal () = Lam. apply ( simpl fn) (Ext_list. map args simpl) loc status in
156
156
begin
157
157
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) ,
159
159
rec_flag)
160
160
})
161
161
->
@@ -177,7 +177,7 @@ let simplify_alias
177
177
end
178
178
else
179
179
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
181
181
then
182
182
183
183
(* let param_map = *)
You can’t perform that action at this time.
0 commit comments