[GHC] #8832: Constant-folding regression wrt `clearBit (bit 0) 0 `
GHC
ghc-devs at haskell.org
Sat Aug 8 14:10:37 UTC 2015
#8832: Constant-folding regression wrt `clearBit (bit 0) 0 `
-------------------------------------+-------------------------------------
Reporter: hvr | Owner:
Type: bug | Status: new
Priority: high | Milestone: 7.12.1
Component: Compiler | Version: 7.8.1-rc2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Runtime | Test Case:
performance bug | simplCore/should_compile/T8832
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by bgamari):
The problem here is that the `Bits` instance for `Integer` overrides
`bit`, using it's own `bitInteger` function in place of the usual
`bitDefault`. `bitDefault` is constant folded by `PrelRules` by virtue of
being implemented in terms of `shiftL`.
This is presumably done to optimize the case of construction of a `BigNat`
for large arguments, but `bitBigNat#`, which is what handles this case, is
currently just the naive implementation with a TODO.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8832#comment:23>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list