Re: [GHC] #2988: Improve float-in

#2988: Improve float-in -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: task | Status: new Priority: lowest | Milestone: 8.4.1 Component: Compiler | Version: 6.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.2.1 => 8.4.1 @@ -2,1 +2,1 @@ - {{{ + {{{#!hs @@ -18,1 +18,1 @@ - {{{ + {{{#!hs @@ -26,1 +26,1 @@ - {{{ + {{{#!hs New description: At the moment we can get a cascade of simplifier iterations like this: {{{#!hs 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: {{{#!hs 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: {{{#!hs -- 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 ...and check on performance changes, and whether `FloatIn` is doing the Right Thing. Simon -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/2988#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC