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,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 379
    • Merge Requests 379
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2988

Closed
Open
Opened Jan 29, 2009 by Simon Peyton Jones@simonpjDeveloper

Improve float-in

At the moment we can get a cascade of simplifier iterations like this:

let x1 = blah
    x2 = x1 : []
    x3 = 1 : x2
    x4 = 2 : x3
in case blah of
  True -> f x4
  False -> g x4

Then x4 satisfies the conditions for postInlineUnconditionally (not top-level, used once in each case branch, not inside lambda). So it's inlined. In the next iteration of the simplifier, x3 satisfies the conditions, and so on.

It might be better for postUnconditionally to require an interesting context. But then this case doesn't work so well:

   let x = blah in case foo of { A -> ..x..; B -> ..x..; C -> ..no x.. }

If C is the hot branch, it's a good idea to push x into the A,B branches.

But perhaps this question is one that FloatIn should deal with, not postInlineUnconditionally. Indeed FloatIn has the following comment:

		-- For case expressions we duplicate the binding if it is
		-- reasonably small, and if it is not used in all the RHSs
		-- This is good for situations like
		--	let x = I# y in
		--	case e of
		--	  C -> error x
		-- 	  D -> error x
		--	  E -> ...not mentioning x...

So this ticket is just to record the idea:

  • Make postInlineUnconditionally check for interesting context
  1. ..and check on performance changes, and whether FloatIn is doing the Right Thing.

Simon

Edited Mar 10, 2019 by Ben Gamari
Assignee
Assign to
8.4.1
Milestone
8.4.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2988