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

LVN missed opportunity for eq? #99

Open
Xazax-hun opened this issue Dec 21, 2020 · 5 comments
Open

LVN missed opportunity for eq? #99

Xazax-hun opened this issue Dec 21, 2020 · 5 comments

Comments

@Xazax-hun
Copy link

As far as I understand, if two values have the same value number, they are guaranteed to be the same at runtime. As a result, for operator eq, if both operands have the same value number (even if they are not constants) we could fold the operator to a constant true.

@Xazax-hun
Copy link
Author

Also for comparison operators, we might be able to fold when only one argument is constant. E.g. false && var.

@sampsyo
Copy link
Owner

sampsyo commented Dec 21, 2020

Yeah, that seems quite plausible! I'd be happy to merge those identities in the example LVN implementation if they're not too tricky to implement.

@cgyurgyik
Copy link
Contributor

Since bril doesn't support logical operators (please correct me if I'm wrong), this should be OK to close?

@sampsyo
Copy link
Owner

sampsyo commented Jan 5, 2021

We do have and, or, and not: https://capra.cs.cornell.edu/bril/lang/core.html#logic

@cgyurgyik
Copy link
Contributor

https://capra.cs.cornell.edu/bril/lang/core.html#logic

Well that's embarrassing. I'll get a patch in for this.

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

No branches or pull requests

3 participants