Add optimizations for case when result is equal
- Dominant language
- Standard ML
- Stars
- 1.2k
- Forks
- 104
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 16
Description
when cakeml is given
```
fun evaluated_case_elim x =
case x of
A a => A a
| B a b => B a b
| C a b c => C a b c;
```
it results in cakeml doing a heap allocation to deconstruct and reconstruct the result.
there should be an optimization that makes it rewritten to a form like
```
fun evaluated_case_elim x =
case x of
A a => x
| B a b => x
| C a b c => x;
```
and it should be done such that when #1106 is done it is
simplified into an identity function
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue provides no file, test, or entry point. Start by locating CakeML's case-elimination transformation and reviewing the interaction described with #1106. Done means equivalent constructor-rebuilding cases avoid the unnecessary allocation and simplify to an identity function when #1106 is complete.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100