Original bug ID: 4555 Reporter: pzimmer Status: closed (set by @garrigue on 2008-08-27T10:24:31Z) Resolution: fixed Priority: normal Severity: minor Version: 3.10.2 Fixed in version: 3.11+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: dvaillancourt BenediktGrundmann @mshinwell sweeks sds yminsky pzimmer @mmottl
Bug description
The following code:
let f x = x = `Test
generates a call to caml_equal for the comparison. Equivalent code using pattern matching or (==) generates optimized code with an integer comparison. This looks like one trivial optimization case is missing in the compiler.
Here is a proposed patch (contributed by Mark Shinwell) that seems to be correct and fixes the problem:
Note that I accidentally miscategorized this entry: it should be in "OCaml general" and not in "Caml-light". If one of the admins could fix it, that would be great. Thanks.
vicuna commentedMay 19, 2008
Original bug ID: 4555
Reporter: pzimmer
Status: closed (set by @garrigue on 2008-08-27T10:24:31Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.10.2
Fixed in version: 3.11+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: dvaillancourt BenediktGrundmann @mshinwell sweeks sds yminsky pzimmer @mmottl
Bug description
The following code:
let f x = x = `Test
generates a call to caml_equal for the comparison. Equivalent code using pattern matching or (==) generates optimized code with an integer comparison. This looks like one trivial optimization case is missing in the compiler.
Here is a proposed patch (contributed by Mark Shinwell) that seems to be correct and fixes the problem:
--- ocaml-3.10.2/bytecomp/translcore.ml 2007-02-09 08:31:15.000000000 -0500
+++ ocaml-3.10.2-patched/bytecomp/translcore.ml 2008-05-16 18:46:48.000076000 -0400
@@ -279,6 +279,12 @@ let transl_prim prim args =
| [{exp_desc = Texp_construct({cstr_tag = Cstr_constant _}, _)}; arg2]
when simplify_constant_constructor ->
intcomp
|| has_base_type arg1 Predef.path_char ->
intcomp
The text was updated successfully, but these errors were encountered: