Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optimizations for case when result is equal #1108

Open
ordinarymath opened this issue Dec 8, 2024 · 0 comments
Open

Add optimizations for case when result is equal #1108

ordinarymath opened this issue Dec 8, 2024 · 0 comments

Comments

@ordinarymath
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants