[GHC] #14626: No need to enter a scrutinised value

GHC ghc-devs at haskell.org
Wed Jan 3 00:33:24 UTC 2018


#14626: No need to enter a scrutinised value
-------------------------------------+-------------------------------------
        Reporter:  heisenbug         |                Owner:  heisenbug
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  performance
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13861            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Puzzled by comment:2 I tried it myself.  Sure enough, the evaluted-ness
 flags, so carefully attached by `CoreTidy` were being lost in `CorePrep`.

 This turned out to date back at least 7 years.

 * See `Note [dataToTag magic]` in `CorePrep`.  It relies evaluated-ness
 flags.

 * But those flags were being killed off in `cpCloneBndr`, for reasons
 described in `Note [Dead code in CorePrep]`.

 * This was just a bug: it means that the `dataToTag magic` doesn't work
 properly.  Sure enough we get a redundant case (after `CorePrep`) with
 this program
 {{{
 data T = MkT !Bool

 f v = case v of
          MkT y -> dataToTag# y
 }}}
   After `CorePrep` we end up with
 {{{
 f v = case v of
          MkT y -> case y of z -> dataToTag# z
 }}}
   which is silly.

 I'll fix all this and add suitable comments

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


More information about the ghc-tickets mailing list