[GHC] #9718: Avoid TidyPgm predicting what CorePrep will do
GHC
ghc-devs at haskell.org
Mon Dec 3 06:27:52 UTC 2018
#9718: Avoid TidyPgm predicting what CorePrep will do
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
Resolution: | Keywords: CodeGen, CAFs
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 osa1):
I almost finished the analysis implementation (I don't update the .hi file
or
ModIface yet). I currently have a sanity check that after analysis
compares
CafInfos computed by TidyPgm with the CafInfos the new analysis computes,
and I
can see cases when building stage 2 where the results differ. For example,
for
this definition:
(libraries/base/GHC/Base.hs)
{{{
GHC.Base.$fFunctor-> [InlPrag=NOUSERINLINE CONLIKE]
:: forall r. GHC.Base.Functor ((->) r)
[GblId[DFunId], Str=m] =
CCS_DONT_CARE GHC.Base.C:Functor! [GHC.Base..
GHC.Base.$fFunctor->_$c<$];
}}}
This definition itself is not a CAF, so we look at the free variables
`GHC.Base.$fFunctor->_$c<$` and `GHC.Base..`:
{{{
GHC.Base.. [InlPrag=INLINE (sat-args=2)]
:: forall b c a. (b -> c) -> (a -> b) -> a -> c
[GblId,
Arity=3,
Caf=NoCafRefs,
Str=<C(S),1*C1(U)><L,1*C1(U)><L,U>,
Unf=OtherCon []] =
\r [f_s6N7 g_s6N8 x_s6N9]
let {
sat_s6Na [Occ=Once] :: b_a2Yb
[LclId] =
\u [] g_s6N8 x_s6N9;
} in f_s6N7 sat_s6Na;
}}}
This itself is not a CAF and has no free variables, so not CAFFY.
{{{
GHC.Base.$fFunctor->_$c<$ :: forall r a b. a -> (r -> b) -> r -> a
[GblId,
Arity=3,
Caf=NoCafRefs,
Str=<S,1*U><L,A><L,A>,
Unf=OtherCon []] =
\r [x_s6Ng eta_s6Nh eta1_s6Ni] x_s6Ng;,
}}}
This also isn't a CAF itself and has no free variables. So really
`fFunctor->`
should not be CAFFY, but its `CafInfo` says it may have refs. I don't know
which
Core pass thinks that this function may have CAF refs, and why.
We have more info about what is CAF and what is not in STG so the new
analysis
may make more things non-CAFFY, which is a good thing. But I still want to
understand why a Core pass things this definition is CAFFY.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9718#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list