[GHC] #10346: Cross-module SpecConstr
GHC
ghc-devs at haskell.org
Mon May 7 14:01:50 UTC 2018
#10346: Cross-module SpecConstr
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: ckoparkar
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.1
Resolution: | Keywords: SpecConstr,
| newcomer
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #13016 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by ckoparkar):
I did use that patch. However, I couldn't get it to do what we want. Not
sure if I did something wrong. I'm using the example given in the
description:
{{{
module M where
{-# INLINABLE foo #-}
foo True y = y
foo False (a,b) = foo True (a+b,b)
baz = foo False (1,2)
-----------------------------------
module X where
import M
bar = foo False (3,4)
}}}
and compiling it with `ghc-stage2 -fforce-recomp -ddump-spec -ddump-rules
-O X.hs`.
Relevant Core output:
{{{
baz :: (Integer, Integer)
[LclIdX,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 240 0}]
baz = foo_aZc GHC.Types.False (1, 2)
}}}
where `foo_aZc` is the specialized version of `foo`. On the other hand,
`bar` still uses the regular `foo`.
{{{
bar :: (Integer, Integer)
[LclIdX,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 250 0}]
bar = foo @ Integer GHC.Num.$fNumInteger GHC.Types.False (3, 4)
}}}
I'm going to use that patch as a starting point though.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10346#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list