combineIdenticalAlts is only partially implemented
combineIdenticalAlts commons up branches of case expressions which have the same RHS.
However, it is not fully implemented so opportunities to common up branches are missed. For very big case expressions in might impact compilation time but it could be something which is enabled by -O2
.
For example, the C
and D
case for foo
are not commened up but the A
and B
case in foo2
are.
module Foo where
data T = A | B | C | D
foo x = case x of
A -> 0
B -> 1
C -> 2
D -> 2
foo2 x = case x of
A -> 2
B -> 2
C -> 0
D -> 1
See also #18377 for another version of this same issue.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |