No join-point from an INLINE function with wrong arity
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 17 Mar 2017 16:25:41 +0000 (16:25 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 17 Mar 2017 16:31:13 +0000 (16:31 +0000)
commita7dbafe9292212f3cbc21be42eb326ab0701db7e
tree491cefd34aa9c60948e161469eaa7fccd592d051
parent567bc6bd194836233ce1576acd7a62b1867f6607
No join-point from an INLINE function with wrong arity

The main payload of this patch is NOT to make a join-point
from a function with an INLINE pragma and the wrong arity;
see Note [Join points and INLINE pragmas] in CoreOpt.
This is what caused Trac #13413.

But we must do the exact same thing in simpleOptExpr,
which drove me to the following refactoring:

* Move simpleOptExpr and simpleOptPgm from CoreSubst to a new
  module CoreOpt along with a few others (exprIsConApp_maybe,
  pushCoArg, etc)

  This eliminates a module loop altogether (delete
  CoreArity.hs-boot), and stops CoreSubst getting too huge.

* Rename Simplify.matchOrConvertToJoinPoint
     to joinPointBinding_maybe
  Move it to the new CoreOpt
  Use it in simpleOptExpr as well as in Simplify

* Define CoreArity.joinRhsArity and use it
17 files changed:
compiler/coreSyn/CoreArity.hs
compiler/coreSyn/CoreArity.hs-boot [deleted file]
compiler/coreSyn/CoreOpt.hs [new file with mode: 0644]
compiler/coreSyn/CoreSubst.hs
compiler/coreSyn/CoreSyn.hs
compiler/coreSyn/CoreUnfold.hs
compiler/deSugar/Desugar.hs
compiler/deSugar/DsBinds.hs
compiler/ghc.cabal.in
compiler/ghc.mk
compiler/main/GhcPlugins.hs
compiler/prelude/PrelRules.hs
compiler/simplCore/Simplify.hs
compiler/specialise/Rules.hs
compiler/specialise/Specialise.hs
testsuite/tests/simplCore/should_compile/T13413.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T