Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005580OCamlOCaml backend (code generation)public2012-04-09 18:302013-06-07 13:33
Reporterjfc 
Assigned Toxleroy 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86-64OSLinuxOS Version
Product Version3.12.1 
Target Version4.01.0+devFixed in Version4.01.0+dev 
Summary0005580: Inlining misses some simple simplifications
DescriptionConsider 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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0009427)
xleroy (administrator)
2013-06-07 13:33

Improved constant propagation in commit r13754. Will be in release 4.01.

- Issue History
Date Modified Username Field Change
2012-04-09 18:30 jfc New Issue
2012-04-10 15:55 doligez Status new => acknowledged
2012-07-09 17:39 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-21 14:14 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-06-06 11:13 xleroy Assigned To => xleroy
2013-06-06 11:13 xleroy Status acknowledged => assigned
2013-06-07 13:33 xleroy Note Added: 0009427
2013-06-07 13:33 xleroy Status assigned => resolved
2013-06-07 13:33 xleroy Resolution open => fixed
2013-06-07 13:33 xleroy Fixed in Version => 4.01.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker