Commit d1179c4b authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

ghc-prim: Delay inlining of {gt,ge,lt,le}Int to phase 1

Otherwise rewrite rules may not get an opporunity to fire.
parent 7aa4c52f
......@@ -90,8 +90,8 @@ the @(==)@ class operation rule may rewrite the predicate before our @break@
rule has a chance to fire.
For this reason, most of the primitive types in @base@ have 'Eq' instances
defined in terms of helper functions with delayed inlinings. For instance,
@Word8@\'s @Eq@ instance looks like,
defined in terms of helper functions with inlinings delayed to phase 1. For
instance, @Word8@\'s @Eq@ instance looks like,
> instance Eq Word8 where
> (==) = eqWord8
......@@ -176,6 +176,7 @@ instance Eq Word where
(==) = eqWord
(/=) = neWord
-- See GHC.Classes#matching_overloaded_methods_in_rules
{-# INLINE [1] eqWord #-}
{-# INLINE [1] neWord #-}
eqWord, neWord :: Word -> Word -> Bool
......@@ -187,6 +188,7 @@ instance Eq Char where
(==) = eqChar
(/=) = neChar
-- See GHC.Classes#matching_overloaded_methods_in_rules
{-# INLINE [1] eqChar #-}
{-# INLINE [1] neChar #-}
eqChar, neChar :: Char -> Char -> Bool
......@@ -196,6 +198,7 @@ eqChar, neChar :: Char -> Char -> Bool
instance Eq Float where
(==) = eqFloat
-- See GHC.Classes#matching_overloaded_methods_in_rules
{-# INLINE [1] eqFloat #-}
eqFloat :: Float -> Float -> Bool
(F# x) `eqFloat` (F# y) = isTrue# (x `eqFloat#` y)
......@@ -203,6 +206,7 @@ eqFloat :: Float -> Float -> Bool
instance Eq Double where
(==) = eqDouble
-- See GHC.Classes#matching_overloaded_methods_in_rules
{-# INLINE [1] eqDouble #-}
eqDouble :: Double -> Double -> Bool
(D# x) `eqDouble` (D# y) = isTrue# (x ==## y)
......@@ -211,6 +215,7 @@ instance Eq Int where
(==) = eqInt
(/=) = neInt
-- See GHC.Classes#matching_overloaded_methods_in_rules
{-# INLINE [1] eqInt #-}
{-# INLINE [1] neInt #-}
eqInt, neInt :: Int -> Int -> Bool
......@@ -363,10 +368,11 @@ instance Ord Int where
(>=) = geInt
(>) = gtInt
{-# INLINE gtInt #-}
{-# INLINE geInt #-}
{-# INLINE ltInt #-}
{-# INLINE leInt #-}
-- See GHC.Classes#matching_overloaded_methods_in_rules
{-# INLINE [1] gtInt #-}
{-# INLINE [1] geInt #-}
{-# INLINE [1] ltInt #-}
{-# INLINE [1] leInt #-}
gtInt, geInt, ltInt, leInt :: Int -> Int -> Bool
(I# x) `gtInt` (I# y) = isTrue# (x ># y)
(I# x) `geInt` (I# y) = isTrue# (x >=# y)
......
......@@ -7,8 +7,8 @@ Rule fired: Class op return
Rule fired: Class op foldr
Rule fired: Class op >>
Rule fired: Class op return
Rule fired: <#
Rule fired: tagToEnum#
Rule fired: Class op foldr
Rule fired: fold/build
Rule fired: <#
Rule fired: tagToEnum#
Rule fired: unpack-list
......@@ -51,7 +51,7 @@ test('haddock.base',
test('haddock.Cabal',
[unless(in_tree_compiler(), skip), req_haddock
,stats_num_field('bytes allocated',
[(wordsize(64), 11517963232, 5)
[(wordsize(64), 10941742184, 5)
# 2012-08-14: 3255435248 (amd64/Linux)
# 2012-08-29: 3324606664 (amd64/Linux, new codegen)
# 2012-10-08: 3373401360 (amd64/Linux)
......@@ -75,7 +75,8 @@ test('haddock.Cabal',
# 2015-12-11: 8114833312 (amd64/Linux) - TypeInType (See #11196)
# 2015-12-17: 9982130512 (amd64/Linux) - Update Haddock to master
# 2015-12-22: 10519532424 (amd64/Linux) - Lots of new Semigroup instances in Cabal
# 2016-03-29: 11517963232 (amd64/Linux) - not yet investigated
# 2016-03-29: 11517963232 (amd64/Linux) - not yet investigated
# 2016-03-30: 10941742184 (amd64/Linux) - defer inlining of Int* Ord methods
,(platform('i386-unknown-mingw32'), 3293415576, 5)
# 2012-10-30: 1733638168 (x86/Windows)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment