diff options
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 |
commit | ac977688523e5d77eb6f041f043552410b0c21da (patch) | |
tree | d77cb46adac639d002489f7c2432852a9a506a22 /compiler/coreSyn/CoreUtils.hs | |
parent | d728c3c578cc9e9205def2c1e96934487b364b7b (diff) | |
download | haskell-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/coreSyn/CoreUtils.hs')
-rw-r--r-- | compiler/coreSyn/CoreUtils.hs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 453d984ec4..6dfb1df462 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1696,23 +1696,6 @@ Well, yes. The primop accepts lifted arguments and does not evaluate them. Indeed, in general primops are, well, primitive and do not perform evaluation. -There is one primop, dataToTag#, which does /require/ a lifted -argument to be evaluated. To ensure this, CorePrep adds an -eval if it can't see the argument is definitely evaluated -(see [dataToTag magic] in CorePrep). - -We make no attempt to guarantee that dataToTag#'s argument is -evaluated here. Main reason: it's very fragile to test for the -evaluatedness of a lifted argument. Consider - case x of y -> let v = dataToTag# y in ... - -where x/y have type Int, say. 'y' looks evaluated (by the enclosing -case) so all is well. Now the FloatOut pass does a binder-swap (for -very good reasons), changing to - case x of y -> let v = dataToTag# x in ... - -See also Note [dataToTag#] in primops.txt.pp. - Bottom line: * in exprOkForSpeculation we simply ignore all lifted arguments. * except see Note [seq# and expr_ok] for an exception |