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,269
    • Issues 4,269
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • 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
  • Merge Requests
  • !4493

Closed
Opened Nov 23, 2020 by Sebastian Graf@sgraf812Developer
  • Report abuse
Report abuse

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "wip/T18894" "origin/wip/T18894"

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "master"
git merge --no-ff "wip/T18894"

Step 4. Push the result of the merge to GitLab

git push origin "master"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

DmdAnal: Annotate some top-level bindings with demands (#18894)

  • Overview 24
  • Commits 2
  • Pipelines 21
  • Changes 18

It's useful to annotate a non-exported top-level function like g in

module Lib (h) where

g :: Int -> Int -> (Int,Int)
g m 1 = (m, 0)
g m n = (2 * m, 2 `div` n)
{-# NOINLINE g #-}

h :: Int -> Int
h 1 = 0
h m
  | odd m     = snd (g m 2)
  | otherwise = uncurry (+) (g 2 m)

with its demand UCU(CS(P(1P(U),SP(U)), which tells us that whenever g was called, the second component of the returned pair was evaluated strictly.

Since #18903 (closed) we do so for local functions, where we can see all calls. For top-level functions, we can assume that all exported functions are demanded according to topDmd and thus get sound demands for non-exported top-level functions.

The demand on g is crucial information for Nested CPR, which may the go on and unbox g for the second pair component. That is true even if that pair component may diverge, as is the case for the call site g 13 0, which throws a div-by-zero exception.

We only track bindings of function type in order not to risk huge compile-time regressions, see isInterestingTopLevelFn.

Fixes #18894 (closed).

Edited Nov 27, 2020 by Sebastian Graf
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
Reference: ghc/ghc!4493
Source branch: wip/T18894