[GHC] #8326: Place heap checks common in case alternatives before the case
GHC
ghc-devs at haskell.org
Sun Sep 28 16:47:14 UTC 2014
#8326: Place heap checks common in case alternatives before the case
-------------------------------------+-------------------------------------
Reporter: jstolarek | Owner:
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: | Blocked By:
None/Unknown | Related Tickets: #1498
Test Case: |
Blocking: 8317 |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by dfeuer):
Replying to [comment:7 jstolarek]:
> Replying to [comment:3 dfeuer]:
> > If I hand it `12#`, it will dutifully tell me `False`. What exactly
have I learned from that?
> That the argument you passed is not a valid tag for `True`.
>
> This ticket is not really about `isTrue#` or `isFalse#` - which are just
tools a programmer might want or not want to use - but about fixing the
heap checks and thus fixing #8317. If you feel that `isTrue#` and
`isFalse#` don't offer you any benefit you can still use `tagToEnum#`.
I'm not sure where the appropriate place is for this line of discussion,
but it seems that in the wild (all over the library source), `isTrue#` is
typically used as a function for converting from `Int#`, produced by a
comparison operator, to `Bool`, rather than as a validity test for `True`.
I have yet to see any explanation of why that is appropriate. Certainly,
optimizing heap checks is an entirely different matter, and presumably a
good idea regardless.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8326#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list