diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-06-10 09:25:57 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-06-13 12:08:28 -0400 |
commit | 0bd3b9dd0428855b6f72f757c1214b5253aa7753 (patch) | |
tree | 6d0445b54a09eee68047b78231482a4be6363a47 /compiler/coreSyn/CoreSyn.hs | |
parent | 5ce63d52fed05371edb34b4f330c33bc85a45127 (diff) | |
download | haskell-wip/T16742.tar.gz |
PrelRules: Don't break let/app invariant in shiftRulewip/T16742
Previously shiftRule would rewrite as invalid shift like
```
let x = I# (uncheckedIShiftL# n 80)
in ...
```
to
```
let x = I# (error "invalid shift")
in ...
```
However, this breaks the let/app invariant as `error` is not
okay-for-speculation. There isn't an easy way to avoid this so let's not
try. Instead we just take advantage of the undefined nature of invalid
shifts and return zero.
Fixes #16742.
Diffstat (limited to 'compiler/coreSyn/CoreSyn.hs')
-rw-r--r-- | compiler/coreSyn/CoreSyn.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index f48fef568e..95b05392ae 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -445,6 +445,9 @@ which will generate a @case@ if necessary The let/app invariant is initially enforced by mkCoreLet and mkCoreApp in coreSyn/MkCore. +For discussion of some implications of the let/app invariant primops see +Note [Checking versus non-checking primops] in PrimOp. + Note [CoreSyn type and coercion invariant] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We allow a /non-recursive/, /non-top-level/ let to bind type and |