Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 457
    • Merge requests 457
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21456
Closed
Open
Created Apr 29, 2022 by Andreas Klebinger@AndreasKDeveloper

SpecConstr: -fspec-constr-threshold has likely some undesired behaviour

As the user guide helpfully points out -fspec-constr-threshold does "Set the size threshold for the SpecConstr transformation."

Currently best I can tell what it does is that if any rhss of a recursive group is larger than threshold we avoid specializing any of them. I assume to avoid code blowup. So far so good.


But I think we still traverse the AST looking for local bindings to specialize. We don't check the size of local bindings when deciding if we should specialise. So if the top level binding is just a thin (recursive) function over a huge local binding we would still end up specializing the local binding anyway.
As a result using -fspec-constr-threshold avoid code size blowups is hit and miss.

We also make the decision for the whole recursive group. But if we have some group:

Rec {
f_huge = <huge>
f_2 = <smallish>
f_3 = <smallish>
}

We should still specialize f_2 and f_3 for all call patterns inside the whole group. There is really no good reason not to!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking