You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7384 Reporter: @sliquister Assigned to:@alainfrisch Status: resolved (set by @alainfrisch on 2016-10-17T08:37:45Z) Resolution: fixed Priority: normal Severity: minor Version: 4.03.0 Fixed in version: 4.04.0 +dev / +beta1 / +beta2 Category: middle end (typedtree to clambda) Related to:#7345 Monitored by:@gasche
Bug description
The optimization of optional arguments probably breaks because -g inserts nodes in the lambda AST, which breaks Simplif.split_default_wrapper.
While I'm creating a ticket, I'll note it'd be nice if this optimization worked in cases where we cannot use optional arguments without being forced to introduce some silly unit parameters:
let f ?x t =
let x =
match x with
| None -> String.length t
| Some x -> x
in
..
(of course one can write wrappers, but with this reasoning the existing optimization is not necessary either)
Original bug ID: 7384
Reporter: @sliquister
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2016-10-17T08:37:45Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.03.0
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: middle end (typedtree to clambda)
Related to: #7345
Monitored by: @gasche
Bug description
The optimization of optional arguments probably breaks because -g inserts nodes in the lambda AST, which breaks Simplif.split_default_wrapper.
$ cat c.ml
let f ?(x = 1) y = x + y
$ ocamlopt -S -c c.ml && grep -m1 inner c.s
.globl camlC__f_inner_4
$ ocamlopt -g -S -c c.ml && grep -m1 inner c.s
$
$ ocamlopt -dlambda -g -S -c c.ml && grep -m1 inner c.s
(let
(f/1199 =
(function opt/1200 y/1203
(funct-body c.ml(1):6-24
(before c.ml(1):19-24
(let
(x/1201 =
(if opt/1200 (before c.ml(1):12-13 (field 0 opt/1200))
(before c.ml(1):12-13 1)))
(before c.ml(1):19-24 (+ x/1201 y/1203)))))))
(pseudo none(1):-1--1 (makeblock 0 f/1199)))
I think this is worth fixing because it impacts both the normal backend and flambda (as the function might be too big to inline repeatedly).
The text was updated successfully, but these errors were encountered: