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
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: