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 ne, eq, fix fold bug. #106

Merged
merged 12 commits into from
Jan 1, 2021
Merged

Add ne, eq, fix fold bug. #106

merged 12 commits into from
Jan 1, 2021

Conversation

cgyurgyik
Copy link
Contributor

bril2json < comparisons.bril | python3 examples/lvn.py -p -c -f | bril2txt

@main {
  a: int = const 4;
  b: int = const 3;
  c: bool = eq a b;
  print c;
}

=>

@main {
  a: int = const 4;
  b: int = const 3;
  c: bool = const false;
  print c;
}

Initially this was not folding since const == False.

@cgyurgyik
Copy link
Contributor Author

cgyurgyik commented Dec 30, 2020

Address #99 .

Case A

@main(a: int) {
  c: bool = eq a a;
}

=>

@main(a: int) {
  c: bool = const true; // Guaranteed
}

Case B

@main(a: int) {
  c: bool = ne a a;
}

=>

@main(a: int) {
  c: bool = const false; // Guaranteed
}

Case C

@main(a: int, b: int) {
  c: bool = eq a b;
  d: bool = ne a b;
}

=>

@main(a: int, b: int) {
  c: bool = eq a b; // Who knows???
  d: bool = ne a b; // Who knows???
}

Copy link
Owner

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems great! What do you think about adding your test cases from the issue body as test files herein?

examples/lvn.py Outdated Show resolved Hide resolved
examples/lvn.py Outdated Show resolved Hide resolved
examples/lvn.py Show resolved Hide resolved
cgyurgyik and others added 3 commits December 31, 2020 16:29
@cgyurgyik
Copy link
Contributor Author

Seems great! What do you think about adding your test cases from the issue body as test files herein?

Is there some place specifically LVN is tested?

@sampsyo
Copy link
Owner

sampsyo commented Dec 31, 2020

Ah yeah, good point: I have them here. https://github.com/sampsyo/bril/tree/master/examples/test/lvn

@cgyurgyik
Copy link
Contributor Author

Ah yeah, good point: I have them here. https://github.com/sampsyo/bril/tree/master/examples/test/lvn

Thanks! Didn't see those. Done.

Copy link
Owner

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wahoo; perfect! Thanks!!

examples/lvn.py Show resolved Hide resolved
@sampsyo sampsyo merged commit 4e6abc5 into sampsyo:master Jan 1, 2021
@cgyurgyik cgyurgyik mentioned this pull request Jan 5, 2021
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.

2 participants