[commit: ghc] master: Restrict exprOkForSpeculation/case to unlifted types (a0b7b10)
git at git.haskell.org
git at git.haskell.org
Fri Aug 25 11:57:32 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/a0b7b100c649f01325bc6807e418b7563885120e/ghc
>---------------------------------------------------------------
commit a0b7b100c649f01325bc6807e418b7563885120e
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Aug 22 13:34:31 2017 +0100
Restrict exprOkForSpeculation/case to unlifted types
Consider
case x of y
DEFAULT -> let v::Int# = case y of
True -> e1
False -> e2
in ...
Previously this would have been ok-for-speculation because
y is evaluated. But the binder-swap done
by SetLevels would transform the inner alternative to
DEFAULT -> let v::Int# = case x of { ... }
in ...)
which does /not/ satisfy the let/app invariant, because x is
not evaluated.
I don't know why this has never bitten us before, but it began
to bite when I did upcoming refactoring of the Simplifier.
So this patch narrows exprOkForSpeculation to only work for
/unlifted/ cases.
To make this work I had to make exprOkForSpeculation non-polymorphic
in the binder type, which has a little knock-on for is use in
SetLevels.
(It's annoying that we need to handle cases at all, but see
Note [exprOkForSpeculation: case expressions])
>---------------------------------------------------------------
a0b7b100c649f01325bc6807e418b7563885120e
compiler/coreSyn/CoreUtils.hs | 130 ++++++++++++++++++++++++++--------------
compiler/simplCore/SetLevels.hs | 5 +-
2 files changed, 88 insertions(+), 47 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 a0b7b100c649f01325bc6807e418b7563885120e
More information about the ghc-commits
mailing list