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

Apply flambda2 switch table optimization to naked numbers and symbols #3242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mshinwell
Copy link
Collaborator

This ensures that the optimization that turns an flambda2 Switch into a lookup table, in certain circumstances, applies to the naked number kinds as well, e.g.

type t = A | B | C

let f1 = function
  | A -> 8
  | B -> 4
  | C -> 2

let f2 = function
  | A -> #8l
  | B -> #4l
  | C -> #2l

@mshinwell mshinwell added the flambda2 Prerequisite for, or part of, flambda2 label Nov 8, 2024
@mshinwell mshinwell marked this pull request as draft November 8, 2024 19:01
@mshinwell mshinwell force-pushed the fix-switch-opt-for-unboxed-types branch from 70065f7 to 07247a3 Compare November 8, 2024 19:16
@mshinwell mshinwell changed the title Apply flambda2 switch table optimization to naked numbers Apply flambda2 switch table optimization to naked numbers and symbols Nov 8, 2024
@mshinwell mshinwell marked this pull request as ready for review November 8, 2024 19:16
@mshinwell
Copy link
Collaborator Author

This also now deals with symbols, so it will work for things like boxed floats too.

@mshinwell mshinwell force-pushed the fix-switch-opt-for-unboxed-types branch 2 times, most recently from 066e800 to 3a29f8c Compare November 8, 2024 19:28
@mshinwell mshinwell force-pushed the fix-switch-opt-for-unboxed-types branch from 3a29f8c to 37de111 Compare November 8, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flambda2 Prerequisite for, or part of, flambda2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant