[commit: ghc] wip/T15696: Remove can_fail for dataToTag#, add a special case to app_ok (8305c95)

git at git.haskell.org git at git.haskell.org
Thu Oct 11 11:15:17 UTC 2018


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

On branch  : wip/T15696
Link       : http://ghc.haskell.org/trac/ghc/changeset/8305c955346fd5318b5b3f1c7720f741ca8a75a5/ghc

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

commit 8305c955346fd5318b5b3f1c7720f741ca8a75a5
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Thu Oct 11 14:14:47 2018 +0300

    Remove can_fail for dataToTag#, add a special case to app_ok


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

8305c955346fd5318b5b3f1c7720f741ca8a75a5
 compiler/coreSyn/CoreUtils.hs   | 5 +++--
 compiler/prelude/primops.txt.pp | 1 -
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index 6dfb1df..ebdc31b 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -1557,14 +1557,15 @@ app_ok primop_ok fun args
         | SeqOp <- op    -- See Note [seq# and expr_ok]
         -> all (expr_ok primop_ok) args
 
+        | DataToTagOp <- op
+        -> False -- all (expr_ok primop_ok) args
+
         | otherwise
         -> primop_ok op  -- Check the primop itself
         && and (zipWith arg_ok arg_tys args)  -- Check the arguments
 
       _other -> isUnliftedType (idType fun)          -- c.f. the Var case of exprIsHNF
              || idArity fun > n_val_args             -- Partial apps
-             || (n_val_args == 0 &&
-                 isEvaldUnfolding (idUnfolding fun)) -- Let-bound values
              where
                n_val_args = valArgCount args
   where
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 303c902..e72424b 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2986,7 +2986,6 @@ section "Tag to enum stuff"
 primop  DataToTagOp "dataToTag#" GenPrimOp
    a -> Int#  -- Zero-indexed; the first constructor has tag zero
    with
-   can_fail   = True -- See Note [dataToTag#]
    strictness = { \ _arity -> mkClosedStrictSig [evalDmd] topRes }
 
 primop  TagToEnumOp "tagToEnum#" GenPrimOp



More information about the ghc-commits mailing list