Skip to content

Commit 5cacfa0

Browse files
lpw25mshinwell
authored andcommittedJan 13, 2017
Improve wording of inlining reports (ocaml#1001)
1 parent db07900 commit 5cacfa0

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed
 

‎middle_end/inlining_decision.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ let inline env r ~lhs_of_application
104104
| T.Never_inline -> assert false
105105
| T.Can_inline_if_no_larger_than threshold -> threshold
106106
in
107-
Don't_try_it (S.Not_inlined.Function_obviously_too_large threshold)
107+
Don't_try_it (S.Not_inlined.Above_threshold threshold)
108108
else if not (toplevel && branch_depth = 0)
109109
&& A.all_not_useful (E.find_list_exn env args) then
110110
(* When all of the arguments to the function being inlined are unknown,
@@ -173,7 +173,7 @@ let inline env r ~lhs_of_application
173173
should already have been simplified (inside its declaration), so
174174
we also expect no gain from the code below that permits inlining
175175
inside the body. *)
176-
Don't_try_it S.Not_inlined.Unspecialised
176+
Don't_try_it S.Not_inlined.No_useful_approximations
177177
else begin
178178
(* There are useful approximations, so we should simplify. *)
179179
Try_it
@@ -374,7 +374,7 @@ let specialise env r ~lhs_of_application
374374
| T.Never_inline -> assert false
375375
| T.Can_inline_if_no_larger_than threshold -> threshold
376376
in
377-
Don't_try_it (S.Not_specialised.Function_obviously_too_large threshold)
377+
Don't_try_it (S.Not_specialised.Above_threshold threshold)
378378
else if not (Var_within_closure.Map.is_empty (Lazy.force bound_vars)) then
379379
Don't_try_it S.Not_specialised.Not_closed
380380
else if not (Lazy.force recursive) then

‎middle_end/inlining_stats_types.ml

+13-12
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ end
7373
module Not_inlined = struct
7474
type t =
7575
| Classic_mode
76-
| Function_obviously_too_large of int
76+
| Above_threshold of int
7777
| Annotation
78-
| Unspecialised
78+
| No_useful_approximations
7979
| Unrolling_depth_exceeded
8080
| Self_call
8181
| Without_subfunctions of Wsb.t
@@ -86,19 +86,20 @@ module Not_inlined = struct
8686
| Classic_mode ->
8787
Format.pp_print_text ppf
8888
"This function was prevented from inlining by `-Oclassic'."
89-
| Function_obviously_too_large size ->
89+
| Above_threshold size ->
9090
Format.pp_print_text ppf
9191
"This function was not inlined because \
92-
it was obviously too large";
92+
it was larger than the current size threshold";
9393
Format.fprintf ppf "(%i)" size
9494
| Annotation ->
9595
Format.pp_print_text ppf
9696
"This function was not inlined because \
9797
of an annotation."
98-
| Unspecialised ->
98+
| No_useful_approximations ->
9999
Format.pp_print_text ppf
100100
"This function was not inlined because \
101-
its parameters could not be specialised."
101+
there was no useful information about any of its parameters, \
102+
and it was not particularly small."
102103
| Unrolling_depth_exceeded ->
103104
Format.pp_print_text ppf
104105
"This function was not inlined because \
@@ -118,9 +119,9 @@ module Not_inlined = struct
118119

119120
let calculation ~depth ppf = function
120121
| Classic_mode
121-
| Function_obviously_too_large _
122+
| Above_threshold _
122123
| Annotation
123-
| Unspecialised
124+
| No_useful_approximations
124125
| Unrolling_depth_exceeded
125126
| Self_call -> ()
126127
| Without_subfunctions wsb ->
@@ -169,7 +170,7 @@ end
169170
module Not_specialised = struct
170171
type t =
171172
| Classic_mode
172-
| Function_obviously_too_large of int
173+
| Above_threshold of int
173174
| Annotation
174175
| Not_recursive
175176
| Not_closed
@@ -183,10 +184,10 @@ module Not_specialised = struct
183184
Format.pp_print_text ppf
184185
"This function was prevented from specialising by \
185186
`-Oclassic'."
186-
| Function_obviously_too_large size ->
187+
| Above_threshold size ->
187188
Format.pp_print_text ppf
188189
"This function was not specialised because \
189-
it was obviously too large";
190+
it was larger than the current size threshold";
190191
Format.fprintf ppf "(%i)" size
191192
| Annotation ->
192193
Format.pp_print_text ppf
@@ -220,7 +221,7 @@ module Not_specialised = struct
220221

221222
let calculation ~depth ppf = function
222223
| Classic_mode
223-
| Function_obviously_too_large _
224+
| Above_threshold _
224225
| Annotation
225226
| Not_recursive
226227
| Not_closed

‎middle_end/inlining_stats_types.mli

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ end
3232
module Not_inlined : sig
3333
type t =
3434
| Classic_mode
35-
| Function_obviously_too_large of int
35+
| Above_threshold of int
3636
| Annotation
37-
| Unspecialised
37+
| No_useful_approximations
3838
| Unrolling_depth_exceeded
3939
| Self_call
4040
| Without_subfunctions of
@@ -57,7 +57,7 @@ end
5757
module Not_specialised : sig
5858
type t =
5959
| Classic_mode
60-
| Function_obviously_too_large of int
60+
| Above_threshold of int
6161
| Annotation
6262
| Not_recursive
6363
| Not_closed

0 commit comments

Comments
 (0)
Please sign in to comment.