[GHC] #14684: combineIdenticalAlts is only partially implemented

GHC ghc-devs at haskell.org
Thu Jan 18 18:04:44 UTC 2018


#14684: combineIdenticalAlts is only partially implemented
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 combineIdenticalAlts commons up branches of case expressions which have
 the same RHS.

 However, it is not fully implemented so opportunities to common up
 branches are missed. For very big case expressions in might impact
 compilation time but it could be something which is enabled by `-O2`.

 For example, the `C` and `D` case for `foo` are not commened up but the
 `A` and `B` case in `foo2` are.

 {{{
 module Foo where

 data T = A | B | C | D


 foo x = case x of
           A -> 0
           B -> 1
           C -> 2
           D -> 2

 foo2 x = case x of
           A -> 2
           B -> 2
           C -> 0
           D -> 1
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14684>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list