You need to sign in or sign up before continuing.
Opportunity to improve case-of-case
Consider this code
f g x = (case g x of True -> not
False -> id) `seq` True
With GHC 8 (and -O) we get this Core
f =
\ (@ t_a1rk) (g_aqD :: t -> Bool) (x_aqE :: t) ->
case case g_aqD x_aqE of {
False -> id @ Bool;
True -> not
}
of
{ __DEFAULT ->
GHC.Types.True
}
This is obviously bad.
The reasoning is in the long, complicated Note [Single-alternative cases] in Simplify.hs.
Happily with join points the entire Note becomes unnecessary; we can delete the special case that this Note describes, and the Note itself. Result: simpler compiler, and more optimal code.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |