[commit: ghc] wip/nested-cpr: Some primitive operations are converging (7be1249)

git at git.haskell.org git at git.haskell.org
Wed Jan 15 18:06:55 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nested-cpr
Link       : http://ghc.haskell.org/trac/ghc/changeset/7be1249bb3442aec681bc5287a3162ccab75ddbb/ghc

>---------------------------------------------------------------

commit 7be1249bb3442aec681bc5287a3162ccab75ddbb
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Jan 10 13:42:21 2014 +0000

    Some primitive operations are converging


>---------------------------------------------------------------

7be1249bb3442aec681bc5287a3162ccab75ddbb
 compiler/prelude/PrimOp.lhs                                 |    4 +++-
 compiler/prelude/primops.txt.pp                             |    1 +
 testsuite/tests/simplCore/should_compile/spec-inline.stderr |    4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/compiler/prelude/PrimOp.lhs b/compiler/prelude/PrimOp.lhs
index 12f71c2..2ee7da4 100644
--- a/compiler/prelude/PrimOp.lhs
+++ b/compiler/prelude/PrimOp.lhs
@@ -516,8 +516,10 @@ primOpOcc op = case primOpInfo op of
 
 primOpSig :: PrimOp -> ([TyVar], [Type], Type, Arity, StrictSig)
 primOpSig op
-  = (tyvars, arg_tys, res_ty, arity, primOpStrictness op arity)
+  = (tyvars, arg_tys, res_ty, arity, strict_sig)
   where
+    strict_sig | primOpOkForSpeculation op = convergeSig $ primOpStrictness op arity
+               | otherwise                 =               primOpStrictness op arity
     arity = length arg_tys
     (tyvars, arg_tys, res_ty)
       = case (primOpInfo op) of
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 36eec67..f020ae8 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -61,6 +61,7 @@ defaults
    can_fail         = False   -- See Note Note [PrimOp can_fail and has_side_effects] in PrimOp
    commutable       = False
    code_size        = { primOpCodeSizeDefault }
+   -- Strictness is turned to terminating in PrimOp.primOpSig, if allowed
    strictness       = { \ arity -> mkClosedStrictSig (replicate arity topDmd) topRes }
    fixity           = Nothing
    llvm_only        = False
diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
index 0a53e18..27607ee 100644
--- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr
+++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
@@ -16,7 +16,7 @@ Roman.foo_$s$wgo =
   \ (sc :: GHC.Prim.Int#) (sc1 :: GHC.Prim.Int#) ->
     let {
       a :: GHC.Prim.Int#
-      [LclId, Str=DmdType]
+      [LclId, Str=DmdType t]
       a =
         GHC.Prim.+#
           (GHC.Prim.+#
@@ -60,7 +60,7 @@ Roman.$wgo =
         case x of _ [Occ=Dead] { GHC.Types.I# ipv ->
         let {
           a :: GHC.Prim.Int#
-          [LclId, Str=DmdType]
+          [LclId, Str=DmdType t]
           a =
             GHC.Prim.+#
               (GHC.Prim.+#



More information about the ghc-commits mailing list