[GHC] #8668: SPECIALIZE silently fails to apply
GHC
ghc-devs at haskell.org
Sat Feb 1 19:26:37 UTC 2014
#8668: SPECIALIZE silently fails to apply
-------------------------------------+----------------------------------
Reporter: crockeea | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+----------------------------------
Comment (by crockeea):
Replying to [comment:4 simonpj]:
> Incidentally, if you want GHC to auto-specialise an '''imported'''
function, to types that may not even be in scope in the defining module,
you should mark that function as `INLINABLE`
I have been playing around with this some more, and found something
interesting. As I mentioned, despite the fact that I have everything
marked `INLINABLE`, GHC was *not* auto-specializing `plusFastCyc`.
However, if I partially apply the call to `plusFastCyc` in Main to
`iterate (plusFastCyc y) ...` instead of `iterate (\x -> plusFastCyc y x)
...`, GHC *does* automatically specialize the call to `plusFastCyc`.
However, the code is still slow because `(+)` is still not specialized. I
might expect (+) to be specialized for two reasons
1. It is called at the top level in Main.hs in the `foldl`.
2. The docs say that *when* there is an explicit pragma, specialization
is transitive. I could hope that auto-specialization is also transitive.
Is this the case?
Is the problem of GHC specializing the partially applied function but not
the fully applied version related to ticket:8099?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8668#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list