summaryrefslogtreecommitdiff
path: root/compiler/prelude/PrelRules.hs
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2018-10-10 10:07:05 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2018-10-10 10:07:21 +0300
commitac977688523e5d77eb6f041f043552410b0c21da (patch)
treed77cb46adac639d002489f7c2432852a9a506a22 /compiler/prelude/PrelRules.hs
parentd728c3c578cc9e9205def2c1e96934487b364b7b (diff)
downloadhaskell-ac977688523e5d77eb6f041f043552410b0c21da.tar.gz
Fix dataToTag# argument evaluation
See #15696 for more details. We now always enter dataToTag# argument (done in generated Cmm, in StgCmmExpr). Any high-level optimisations on dataToTag# applications are done by the simplifier. Looking at tag bits (instead of reading the info table) for small types is left to another diff. Incorrect test T14626 is removed. We no longer do this optimisation (see comment:44, comment:45, comment:60). Comments and notes about special cases around dataToTag# are removed. We no longer have any special cases around it in Core. Other changes related to evaluating primops (seq# and dataToTag#) will be pursued in follow-up diffs. Test Plan: Validates with three regression tests Reviewers: simonpj, simonmar, hvr, bgamari, dfeuer Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #15696 Differential Revision: https://phabricator.haskell.org/D5201
Diffstat (limited to 'compiler/prelude/PrelRules.hs')
-rw-r--r--compiler/prelude/PrelRules.hs13
1 files changed, 0 insertions, 13 deletions
diff --git a/compiler/prelude/PrelRules.hs b/compiler/prelude/PrelRules.hs
index e94490007f..28c0628f16 100644
--- a/compiler/prelude/PrelRules.hs
+++ b/compiler/prelude/PrelRules.hs
@@ -1030,19 +1030,6 @@ dataToTagRule = a `mplus` b
guard $ ty1 `eqType` ty2
return tag
- -- Why don't we simplify tagToEnum# (dataToTag# x) to x? We would
- -- like to, but it seems tricky. See #14282. The trouble is that
- -- we never actually see tagToEnum# (dataToTag# x). Because dataToTag#
- -- is can_fail, this expression is immediately transformed into
- --
- -- case dataToTag# @T x of wild
- -- { __DEFAULT -> tagToEnum# @T wild }
- --
- -- and wild has no unfolding. Simon Peyton Jones speculates one way around
- -- might be to arrange to give unfoldings to case binders of CONLIKE
- -- applications and mark dataToTag# CONLIKE, but he doubts it's really
- -- worth the trouble.
-
-- dataToTag (K e1 e2) ==> tag-of K
-- This also works (via exprIsConApp_maybe) for
-- dataToTag x