[GHC] #14295: tagToEnum# leads to some silly closures
GHC
ghc-devs at haskell.org
Thu Sep 28 08:22:36 UTC 2017
#14295: tagToEnum# leads to some silly closures
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: datacon-tags
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> When we don't inline, we should still perform a bounds check to avoid
the thunk, no?
Good point. I suppose so... but
* If we did this we'd better give a different name to the primop that
can't fail; otherwise the transformation is plain confusing.
* I'm uncomfortable with transformations that are not readily expressed in
Core. E.g. we could have
{{{
case x of
0# -> blah
DEFAULT -> ...(noFailQuotInt# y x)...
}}}
since we know that `x` is non-zero in the default branch. But then we
might float the subexpression out, and the claim would no longer hold. We
don't have a solid way to prevent this.
So yes one could do it as a `CorePrep` tactic, but it's delicate; and we
risk not getting the benefits because we don't implement the follow-on
transformations.
* I doubt it's worth doing in practice. i.e. the same engineering effort
spent elsewhere might yield more benefit.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14295#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list