Fix dataToTag# argument evaluation
authorÖmer Sinan Ağacan <omeragacan@gmail.com>
Wed, 10 Oct 2018 07:07:05 +0000 (10:07 +0300)
committerBen Gamari <ben@smart-cactus.org>
Sat, 13 Oct 2018 17:30:03 +0000 (13:30 -0400)
commitb11126fc356ad6b02486a6e48101ff662fc773db
tree4a148626b00b1e58cdec10e92325b4ae32a46d62
parenta22ee7050b610b862ebe1eb725e7aa141b766e05
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

(cherry picked from commit ac977688523e5d77eb6f041f043552410b0c21da)
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