
#13720: INLINE pragma semantics changed since 8.0.2 -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It now seems that unfoldings for INLINE things are optimised slightly. This causes different interactions with `RULES` than before. {{{#!hs module A where {-# INLINE f #-} f x = h x h x = x {-# RULES "h x" forall x . h x = error "REWRITE" #-} }}} {{{#!hs module B where import A qux = f 5 }}} Then running {{{
ghc-8.0.2 B.hs -O2 -fforce-recomp -ddump-simpl | grep qux -A5 qux :: Integer [GblId, Str=DmdType x] qux = error .... }}}
{{{
ghc-8.2.0.20170507 B.hs -O2 -fforce-recomp -ddump-simpl | grep qux -A5 qux :: Integer [GblId, Caf=NoCafRefs, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}] qux = 5 }}}
Inspecting the unfoldings, we see that 8.2 optimises the unfoldings to
inline `h` before the rule can apply.
{{{
d61439f58ce9c5a268304423a43b9b44
f :: p -> p
{- Arity: 1, HasNoCafRefs, Strictness: ,
Inline: (sat-args=1),
Unfolding: InlineRule (1, False, True) (\ @ p (x :: p) -> x) -}
}}}
Is this new behaviour intentional? It seems possible that it will break
some programs which use rewrite rules.
--
Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13720
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler