| Anonymous | Login | Signup for a new account | 2013-05-20 01:02 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
| 0005595 | OCaml | OCaml backend (code generation) | public | 2012-04-17 16:00 | 2012-04-19 17:20 | |||||||
| Reporter | frisch | |||||||||||
| Assigned To | frisch | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | have not tried | |||||||
| Status | resolved | Resolution | fixed | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | ||||||||||||
| Target Version | Fixed in Version | |||||||||||
| Summary | 0005595: Missed constant propagation | |||||||||||
| Description | The following patch: =================================================================== --- asmcomp/cmmgen.ml (revision 12366) +++ asmcomp/cmmgen.ml (working copy) @@ -78,7 +78,10 @@ (Nativeint.add (Nativeint.shift_left (Nativeint.of_int n) 1) 1n) let add_const c n = - if n = 0 then c else Cop(Caddi, [c; Cconst_int n]) + if n = 0 then c + else match c with + | Cconst_int x when no_overflow_add x n -> Cconst_int (x + n) + | c -> Cop(Caddi, [c; Cconst_int n]) let incr_int = function Cconst_int n when n < max_int -> Cconst_int(n+1) =================================================================== improves code generation, for instance for the following example: =================================================================== let () = let tr = Bigarray.(Array2.of_array int fortran_layout [| [|1|] |]) in for i = 1 to 1000000000 do ignore tr.{1, 1} done =================================================================== On my machine, runtime goes from 1.77s to 1.46s. | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-04-17 16:00 | frisch | New Issue | |
| 2012-04-18 09:07 | frisch | Assigned To | => frisch |
| 2012-04-18 09:07 | frisch | Status | new => assigned |
| 2012-04-18 09:17 | frisch | Note Added: 0007373 | |
| 2012-04-18 09:17 | frisch | Status | assigned => resolved |
| 2012-04-18 09:17 | frisch | Resolution | open => fixed |
| Copyright © 2000 - 2011 MantisBT Group |