[GHC] #14684: combineIdenticalAlts is only partially implemented

GHC ghc-devs at haskell.org
Sun Apr 1 13:59:14 UTC 2018


#14684: combineIdenticalAlts is only partially implemented
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  sjakobi
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4542
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by sjakobi):

 * cc: dfeuer (added)


Comment:

 Replying to [comment:11 simonpj]:

 Thanks for your comments, Simon!

 I realized that if I apply the combine-most-common-alts optimization
 ''only''  in `CSE.combineAlts`, we'd get "suboptimal" results in cases
 like this:


 {{{#!hs
 case x of
   A -> 1
   B -> 1
   C -> 2
   D -> 2
   E -> 2
 }}}

 Here, `combineIdenticalAlts` (which in my understanding runs first) would
 combine the `A` and `B` alts, defeating `CSE.combineAlts` which could
 combine `C`, `D` and `E`.

 I'm not sure if this warrants doing the optimization in both places with
 `-O2`.

 -------------

 I also noticed that unlike `combineIdenticalAlts` `CSE.combineAlts`
 doesn't combine the ticks of the identical alts. Would you, David, happen
 to know why this is permissible in this case?

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


More information about the ghc-tickets mailing list