Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,268
    • Issues 4,268
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 408
    • Merge Requests 408
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5000

Closed
Open
Opened Mar 07, 2011 by batterseapower@trac-batterseapower

Eliminate absent arguments in non-strict positions

One of my programs has this is the output of the post-worker/wrapper simplification:

Rec {
h28_s14N
  :: forall t_aMK t_aML.
     Main.Nat -> t_aMK -> t_aML -> Main.Nat -> Main.Nat
[LclId,
 Arity=4,
 Str=DmdType LLLL,
 Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=4, Value=True,
         ConLike=True, Cheap=True, Expandable=True,
         Guidance=IF_ARGS [0 0 0 0] 6 2}]
h28_s14N =
  \ (@ t_aMK)
    (@ t_aML)
    (az94z94z941_u439_amh :: Main.Nat)
    (awS1_u462_ami :: t_aMK)
    (awS1_u466_amj :: t_aML)
    (x_u590_amk :: Main.Nat) ->
    Main.S
      (h29_s14O
         @ t_aMK
         @ t_aML
         az94z94z941_u439_amh
         awS1_u462_ami
         awS1_u466_amj
         x_u590_amk)

h29_s14O [Occ=LoopBreaker]
  :: forall t_aMK t_aML.
     Main.Nat -> t_aMK -> t_aML -> Main.Nat -> Main.Nat
[LclId,
 Arity=4,
 Str=DmdType LLLS,
 Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=4, Value=True,
         ConLike=True, Cheap=True, Expandable=True,
         Guidance=IF_ARGS [0 0 0 3] 7 0}]
h29_s14O =
  \ (@ t_aMK)
    (@ t_aML)
    (az94z94z941_u439_amm :: Main.Nat)
    (awS1_u462_amn :: t_aMK)
    (awS1_u466_amo :: t_aML)
    (x_u590_amp :: Main.Nat) ->
    case x_u590_amp of _ {
      Main.Z -> az94z94z941_u439_amm;
      Main.S x_u595_amq [Dmd=Just L] ->
        h28_s14N
          @ t_aMK
          @ t_aML
          az94z94z941_u439_amm
          awS1_u462_amn
          awS1_u466_amo
          x_u595_amq
    }
end Rec }

This is ridiculous because the two awS1 arguments are totally dead. This greatly increases allocations made by the program.

These absent arguments should be removed by the strictness analyser, However I speculate that this occurs because the recursive call to h29 is guarded by a use of the S constructor, making it non-strict.

Edited Mar 09, 2019 by batterseapower
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#5000