[GHC] #13221: OccurAnal fails to rediscover join points

GHC ghc-devs at haskell.org
Mon Feb 6 02:25:01 UTC 2017


#13221: OccurAnal fails to rediscover join points
-------------------------------------+-------------------------------------
        Reporter:  lukemaurer        |                Owner:  lukemaurer
            Type:  bug               |               Status:  patch
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:  JoinPoints
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  D3080
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"795bc49ceb12cecf46e0c53a570809c3df85ab9a/ghc"
 795bc49c/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="795bc49ceb12cecf46e0c53a570809c3df85ab9a"
 Fixes for OccurAnal bugs (#13221)

 - OccurAnal: When checking tail calls, count rule's LHS args, not bndrs
 Pretty obvious error in retrospect:
 ```
 let $sj = \y ys -> ...
     {-# RULES "SC:j" forall y ys. j (y:ys) = $sj y ys #-}
     j = \xs -> ...
     in ...
 ```
 A jump on the RHS of a rule for a join point is only okay if the rule's
 LHS is
 saturated - in this case, since the LHS is j (y:ys) and j takes one
 argument,
 both j and $sj can become join points. See Note [Rules and join points]
 in
 OccurAnal. By mistake, OccAnal was counting the rule's binders (y and
 ys) rather
 than the args in its LHS, so $sj wasn't being made a join point.

 - Don't zap tail calls in unfoldings

 This was causing T7796 to squeal about join points not being
 rediscovered.

 Reviewers: bgamari, austin

 Reviewed By: bgamari

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D3080
 }}}

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


More information about the ghc-tickets mailing list