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: 5580 Reporter: jfc Assigned to:@xavierleroy Status: closed (set by @xavierleroy on 2015-12-11T18:19:30Z) Resolution: fixed Priority: normal Severity: minor Platform: x86-64 OS: Linux Version: 3.12.1 Target version: 4.01.0+dev Fixed in version: 4.01.0+dev Category: back end (clambda to assembly) Monitored by:@hcarty
Bug description
Consider this program:
type t = False | True
let of_bool = function true -> True | false -> False
let x = of_bool true
x should be assigned the constant True but ocamlopt generates a runtime comparison (true != false) to decide the result of of_bool.
Closure.simplif_prim_pure receives the arguments
p = Pintcomp Cneq
approxs = [Value_constptr 1; Value_integer 0]
If both approximations were Value_integer the comparison would be simplified.
The function does not know how to compare a constptr and an integer.
If I change simplif_prim_pure to add a case matching [Value_constptr x; Value_integer y] similarly to [Value_integer x; Value_integer y] code generation improves. I don't understand the compiler well enough to know if that is the correct solution.
The text was updated successfully, but these errors were encountered:
Original bug ID: 5580
Reporter: jfc
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2015-12-11T18:19:30Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: x86-64
OS: Linux
Version: 3.12.1
Target version: 4.01.0+dev
Fixed in version: 4.01.0+dev
Category: back end (clambda to assembly)
Monitored by: @hcarty
Bug description
Consider this program:
type t = False | True
let of_bool = function true -> True | false -> False
let x = of_bool true
x should be assigned the constant True but ocamlopt generates a runtime comparison (true != false) to decide the result of of_bool.
Closure.simplif_prim_pure receives the arguments
p = Pintcomp Cneq
approxs = [Value_constptr 1; Value_integer 0]
If both approximations were Value_integer the comparison would be simplified.
The function does not know how to compare a constptr and an integer.
If I change simplif_prim_pure to add a case matching [Value_constptr x; Value_integer y] similarly to [Value_integer x; Value_integer y] code generation improves. I don't understand the compiler well enough to know if that is the correct solution.
The text was updated successfully, but these errors were encountered: