Skip to content

better const folding for int and bool #317

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

better const folding for int and bool #317

wants to merge 10 commits into from

Conversation

Firestar99
Copy link
Member

@Firestar99 Firestar99 commented Jul 3, 2025

see #300

const folding used to only support:

This PR adds const folding for:

  • basic int: sub, div, rem, shr, lshl, ashl, neg, not (+ unchecked variants)
  • basic bool: and, or, xor, not
  • comparison for int and bool (icmp)
  • select with const condition

Should probably add some diff tests

@Firestar99
Copy link
Member Author

@eddyb Do you have any explanation why 43d5107 is required to make libm compile? This PR also adds explicit type checking for each operation, and for some reason libm calls add that meant for integers with two floats instead of calling fadd.

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

Successfully merging this pull request may close these issues.

3 participants