Fix dataToTag# argument evaluation
authorÖmer Sinan Ağacan <omeragacan@gmail.com>
Wed, 10 Oct 2018 07:07:05 +0000 (10:07 +0300)
committerÖmer Sinan Ağacan <omeragacan@gmail.com>
Wed, 10 Oct 2018 07:07:21 +0000 (10:07 +0300)
commitac977688523e5d77eb6f041f043552410b0c21da
treed77cb46adac639d002489f7c2432852a9a506a22
parentd728c3c578cc9e9205def2c1e96934487b364b7b
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
18 files changed:
compiler/codeGen/StgCmmExpr.hs
compiler/codeGen/StgCmmPrim.hs
compiler/coreSyn/CorePrep.hs
compiler/coreSyn/CoreUtils.hs
compiler/prelude/PrelRules.hs
compiler/prelude/PrimOp.hs
compiler/prelude/primops.txt.pp
libraries/base/GHC/Base.hs
testsuite/tests/codeGen/should_compile/Makefile
testsuite/tests/codeGen/should_compile/T14626.hs [deleted file]
testsuite/tests/codeGen/should_compile/all.T
testsuite/tests/codeGen/should_run/T15696_1.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T15696_1.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T15696_2.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T15696_2.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T15696_3.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T15696_3.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/all.T