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

Optimisation corrupts register #147

Open
carlos4242 opened this issue Jun 10, 2019 · 0 comments
Open

Optimisation corrupts register #147

carlos4242 opened this issue Jun 10, 2019 · 0 comments

Comments

@carlos4242
Copy link

I would ike to get a better description for the issue.

This came from a classic "Heisenbug" reported by one of the users of S4A. A variable inside a loop seemed to be calculated wrong, zeroed, so he put in a debug print statement and it started working. This suggested to me an optimiser bug.

Comparing the two .ll.txt files with and without print, you can see swift is outputting correct LLVM IR, the only material difference is the print statement.

main_with_print_(working).ll.txt

main without print (buggy).ll.txt

The original swift code is here...
main for buggy iled 2.swift.txt

However, when compiled, there are differences.

iled test 2 without print (not working).txt

iled test 2 with print (working).txt

The register use in the not working version seems a bit arbitrary and garbled. I'll try to analyse more but at the moment it's expecting r31 to have a value like part of the loop variable but it will always be zero.

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

1 participant