[GHC] #14231: Core lint error "in result of Static argument"

GHC ghc-devs at haskell.org
Mon Sep 25 12:27:54 UTC 2017


#14231: Core lint error "in result of Static argument"
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
                                     |  StaticArgumentTransformation
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mpickering):

 I think this is happening because of `Note [Shadow binder]` which sounds
 quite dubious.

 {{{
 Note [Shadow binding]
  ~~~~~~~~~~~~~~~~~~~~~
  The calls to the inner map inside body[map] should get inlined
  by the local re-binding of 'map'.  We call this the "shadow binding".

  But we can't use the original binder 'map' unchanged, because
  it might be exported, in which case the shadow binding won't be
  discarded as dead code after it is inlined.

  So we use a hack: we make a new SysLocal binder with the *same* unique
  as binder.  (Another alternative would be to reset the export flag.)
 }}}

 Then the shadowed binder is constructed from the unique of the old binder
 and the type of the shadowed_rhs.

 {{{
           shadow_bndr = mkSysLocal (occNameFS (getOccName binder))
                                    (idUnique binder)
                                    (exprType shadow_rhs)
 }}}

 It seems that the idea here is that we want to replace the self-recursive
 call with a call to the sat_worker. The mechanism for this is to create a
 local binding which shadows the top-level id which will be inlined in a
 later pass.

 In other parts of the compiler the way this would be achieved is to create
 a new top-level definition for the satted version of the function and then
 a `RULE` which rewrites the old version to the new version. Would that be
 preferable here as well?

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


More information about the ghc-tickets mailing list