[GHC] #5129: "evaluate" optimized away
GHC
ghc-devs at haskell.org
Tue Mar 20 03:29:09 UTC 2018
#5129: "evaluate" optimized away
-------------------------------------+-------------------------------------
Reporter: dons | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.0.3
Resolution: | Keywords: seq, evaluate
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: #13930 | Differential Rev(s): Phab:D615,
Wiki Page: | Phab:D4514
-------------------------------------+-------------------------------------
Comment (by dfeuer):
This `NOINLINE` strikes me as something fragile that doesn't really get at
the point. I don't have this properly paged in right now, but see
Exceptions/PreciseExceptions for some of my previous thoughts on the
matter. I don't understand the sense in pretending it's "pure". I
''think'' we want to consider it side-effecting. I imagine it's already
marked as lazy, but just in case it's not, it should be. There are
situations where it's okay to remove `seq#`, but I'm less sure how to be
sure that it ''remains'' safe after further transformations. The most
obvious situation:
{{{#!hs
case seq# a s of
(# s', a' #) -> seq# a' s'
-- ==>
seq# a s
}}}
A similar situation:
{{{#!hs
case x of
!x' -> seq# x' s
}}}
Surely we don't want to force `x` twice, but we don't want to drop the
`seq#`; we want to transform this to `seq# x s`.
Suppose we have
{{{#!hs
case x of
!x' -> case f x of
!y -> case seq# x' s of (# s', _ #) -> (# s', y #)
}}}
That's a bit trickier. It's certainly safe to transform it to
{{{#!hs
case seq# x s of
(# s', x' #) -> case f x' of
!y -> (# s', y #)
}}}
That might be too conservative, but I don't know if it will really hurt.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5129#comment:30>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list