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 constant fold #105

Closed
cgyurgyik opened this issue Dec 30, 2020 · 2 comments
Closed

[LVN] Missed constant fold #105

cgyurgyik opened this issue Dec 30, 2020 · 2 comments

Comments

@cgyurgyik
Copy link
Contributor

cgyurgyik commented Dec 30, 2020

I was checking my implementation against the examples, and found this:
bril2json < overwritten-variable.bril | python3 examples/lvn.py -p -c -f | bril2txt

@main {
  v1: int = const 4;
  v2: int = const 0;
  mul1: int = mul v1 v2;
  v2: int = const 3;
}

Lowers to:

@main {
  v1: int = const 4;
  lvn.2: int = const 0;
  mul1: int = mul v1 lvn.2; // <-- This should be folded.
  v2: int = const 3;
}

Expected output:

@main {
  v1: int = const 4;
  lvn.2: int = const 0;
  mul1: int = const 0;
  v2: int = const 3;
}
@cgyurgyik
Copy link
Contributor Author

Let me know if I'm wrong here. I'll come back to this later if so, I need a break from LVN for a little :-)

@sampsyo
Copy link
Owner

sampsyo commented Dec 31, 2020

Huh, yeah, it does look like it should do that. I remember wrestling with something similar earlier, perhaps in the context of #77, but I don't really know why it's missing this.

sampsyo added a commit that referenced this issue 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

No branches or pull requests

2 participants