-
Notifications
You must be signed in to change notification settings - Fork 14
Switch lookup gets turned into a branch to a wrong address #46
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
Comments
If I compile the same LLVM IR with |
I've done a bit more digging. Here's the result of instruction selection on my
Shouldn't Accordingly, the final machine code for
|
So let's focus on
The initial
If I pass
|
Nah, that's not it -- playing around with feeding the same IR to the X86 backend clearly shows that there's some kind of implicit fallthrough to the successor BB, so not having a final jump should be OK. But then that means that maybe the bug is in how we handle these implicit continuations? |
I think I have found a workaround by changing from
to
Since I have no idea what I'm doing, I've posted a question about this to StackOverflow to find out if there's a more principled way to handle these successors-without-jumps: http://stackoverflow.com/q/43816706/477476 |
With the change in #46 (comment), my stripped-down |
This is entirely subsumed by #49 (comment) |
I have the following Rust code:
It is turned into the following LLVM IR:
Compiling that LLVM IR, the resulting object file is, I believe, wrong.
Note that the relocation for 0x1a targets 0x26, which is after the end of the function. I believe the correct target would be 0x1e.
The text was updated successfully, but these errors were encountered: