summaryrefslogtreecommitdiff
path: root/libraries/base
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 /libraries/base
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 'libraries/base')
-rw-r--r--libraries/base/GHC/Base.hs11
1 files changed, 1 insertions, 10 deletions
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 1c927405ce..d1f87e1d62 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -1388,19 +1388,10 @@ unIO (IO a) = a
{- |
Returns the tag of a constructor application; this function is used
by the deriving code for Eq, Ord and Enum.
-
-The primitive dataToTag# requires an evaluated constructor application
-as its argument, so we provide getTag as a wrapper that performs the
-evaluation before calling dataToTag#. We could have dataToTag#
-evaluate its argument, but we prefer to do it this way because (a)
-dataToTag# can be an inline primop if it doesn't need to do any
-evaluation, and (b) we want to expose the evaluation to the
-simplifier, because it might be possible to eliminate the evaluation
-in the case when the argument is already known to be evaluated.
-}
{-# INLINE getTag #-}
getTag :: a -> Int#
-getTag !x = dataToTag# x
+getTag x = dataToTag# x
----------------------------------------------
-- Numeric primops