[commit: ghc] wip/spj-T13397: Improve code generation for conditionals (43540c8)
git at git.haskell.org
git at git.haskell.org
Wed Mar 8 11:08:41 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/spj-T13397
Link : http://ghc.haskell.org/trac/ghc/changeset/43540c8c6b9e914f302c71213a71ab5c780be2ac/ghc
>---------------------------------------------------------------
commit 43540c8c6b9e914f302c71213a71ab5c780be2ac
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Mar 8 11:05:53 2017 +0000
Improve code generation for conditionals
This patch in in preparation for the fix to Trac #13397
The code generator has a special case for
case tagToEnum (a>#b) of
False -> e1
True -> e2
but it was not doing nearly so well on
case a>#b of
DEFAULT -> e1
1# -> e2
This patch arranges to behave essentially identically in
both cases. In due course we can eliminate the special
case for tagToEnum#, once we've completed Trac #13397.
The changes are:
* Make CmmSink swizzle the order of a conditional where necessary;
see Note [Improving conditionals] in CmmSink
* Hack the general case of StgCmmExpr.cgCase so that it use
NoGcInAlts for conditionals. This doesn't seem right, but it's
the same choice as the tagToEnum version. Without it, code size
increases a lot (more heap checks).
There's a loose end here.
* Add comments in CmmOpt.cmmMachOpFoldM
>---------------------------------------------------------------
43540c8c6b9e914f302c71213a71ab5c780be2ac
compiler/cmm/CmmOpt.hs | 83 +++++++++++++++++++++++++++------------
compiler/cmm/CmmSink.hs | 39 +++++++++++++++---
compiler/codeGen/StgCmmClosure.hs | 2 +-
compiler/codeGen/StgCmmExpr.hs | 28 +++++++++++--
compiler/prelude/PrimOp.hs | 7 +++-
5 files changed, 121 insertions(+), 38 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 43540c8c6b9e914f302c71213a71ab5c780be2ac
More information about the ghc-commits
mailing list