Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007449OCamlmiddle end (typedtree to clambda)public2017-01-03 07:542017-02-23 17:05
Reportermarkghayden 
Assigned Tochambart 
PrioritynormalSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformAMD64OSMacOSOS Version10.12.2
Product Version4.04.0 
Target VersionFixed in Version 
Summary0007449: excessive inlining of jump tables
DescriptionSee the attached code. The [to_string] function is inlined at all call sites, even with no optimization specified at the command line (!?!). Note that each call site includes a full copy of the jump table and all the jump branches. The test case here has 30 items. I've seen this with larger cases (300 items). Maybe I'm missing something, but it seems this is really off here since this behavior can result in significant code growth. A work-around is to annotate with '[@inline never]'.
Steps To ReproduceCompile with 4.04.0 or 4.05.0.dev trunk. Note that for 4.05.0.dev, the lookup table is used if all the return values are constants and perhaps that is OK to inline. Added a [failwith] for one of the cases forces the use of jump tables, at least on AMD64.

  ocamlopt -c -S du.ml
Additional InformationSee attached ML file. Assembler output will follow.
Tagsflambda
Attached Files? file icon du.ml [^] (1,347 bytes) 2017-01-03 07:54 [Show Content]
? file icon du.s [^] (36,448 bytes) 2017-01-03 07:55

- Relationships

-  Notes
(0017066)
frisch (developer)
2017-01-03 10:20

Is this this flambda? I cannot reproduce in non-flambda mode, except by passing a large -inline command-line argument to ocamlopt.
(0017067)
markghayden (reporter)
2017-01-03 15:19

All my testing was with flambda-enabled compilers.

- Issue History
Date Modified Username Field Change
2017-01-03 07:54 markghayden New Issue
2017-01-03 07:54 markghayden File Added: du.ml
2017-01-03 07:55 markghayden File Added: du.s
2017-01-03 10:20 frisch Note Added: 0017066
2017-01-03 15:19 markghayden Note Added: 0017067
2017-01-03 15:23 frisch Tag Attached: flambda
2017-01-03 21:59 chambart Assigned To => chambart
2017-01-03 21:59 chambart Status new => assigned
2017-02-23 16:42 doligez Category Ocaml optimization => -Ocaml optimization
2017-02-23 17:05 doligez Category -Ocaml optimization => middle end (typedtree to clambda)


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker