Ticket #2163 (closed bug: invalid)
GHC makes thunks for Integers we are strict in
| Reported by: | igloo | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.8.3 |
| Component: | Compiler | Version: | 6.9 |
| Keywords: | Cc: | dons@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Runtime performance bug | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
We know that timesInteger is strict in both arguments:
$ ./ghc --show-iface ~/ghc/darcs/val/libraries/base/dist/build/GHC/Num.hi | grep -C2 "^timesInteger"
plusInteger :: GHC.Num.Integer -> GHC.Num.Integer -> GHC.Num.Integer
{- Arity: 2 HasNoCafRefs Strictness: SS -}
timesInteger :: GHC.Num.Integer -> GHC.Num.Integer -> GHC.Num.Integer
{- Arity: 2 HasNoCafRefs Strictness: SS -}
class (GHC.Base.Eq a, GHC.Show.Show a) => Num a
but given this code:
module W where
f :: Integer -> Integer
f x = let x' = x + 3
in x' * x'
we still make a thunk for x':
$ ./ghc -c w.hs -O -fforce-recomp -ddump-simpl
==================== Tidy Core ====================
W.lvl :: GHC.Num.Integer
[GlobalId]
[NoCafRefs
Str: DmdType]
W.lvl = GHC.Num.S# 3
W.f :: GHC.Num.Integer -> GHC.Num.Integer
[GlobalId]
[Arity 1
NoCafRefs
Str: DmdType S]
W.f =
\ (x_a5h :: GHC.Num.Integer) ->
let {
x'_sa7 [ALWAYS Just S] :: GHC.Num.Integer
[Str: DmdType]
x'_sa7 = GHC.Num.plusInteger x_a5h W.lvl } in
GHC.Num.timesInteger x'_sa7 x'_sa7
The same is true in both the 6.8 branch and the HEAD.
Change History
Note: See
TracTickets for help on using
tickets.
