Skip to content

SSA Transform relies on initializers to create intial name on stack #16

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

Open
dibyendumajumdar opened this issue Dec 27, 2024 · 0 comments
Labels
fixed Fixed

Comments

@dibyendumajumdar
Copy link
Contributor

This snippet fails:

                func foo(x: Int) {
                    var z: Int
                    while (x > 0) {
                        z = 5
                        if (x == 1)
                            z = z+1
                        x = x - 1
                    }
                }

While this is okay

                func foo(x: Int) {
                    var z = 0
                    while (x > 0) {
                        z = 5
                        if (x == 1)
                            z = z+1
                        x = x - 1
                    }
                }

The problem seems to be in 2nd block of search() where we look for instructions of form v = x op y. The declaration alone does not generate such an instruction.

Potential solution may be that declaration of a var generates a var instruction that defines the var.

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

No branches or pull requests

1 participant