Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upwasm32-unknown-unknown: Incorrect codegen #57152
Comments
nikic
added
A-LLVM
O-wasm
labels
Dec 27, 2018
This comment has been minimized.
This comment has been minimized.
|
This looks like a FastISel bug. |
This comment has been minimized.
This comment has been minimized.
|
Somewhat reduced test case:
Results in (MachineInstr, because WebAssembly is unintelligible to me):
The first store effectively stores a copy of |
This comment has been minimized.
This comment has been minimized.
BonsaiDen
commented
Dec 27, 2018
•
|
I was also able to reduce the rust test case further, having only 3 members does not cause the bug.
I'm also working on a test case showing how a |
This comment has been minimized.
This comment has been minimized.
BonsaiDen
commented
Dec 27, 2018
|
Okay here's the test case for the iterator issue:
This generates the following (incorrect) output, basically skipping the body of the
Removing
|
This comment has been minimized.
This comment has been minimized.
|
I've reported https://bugs.llvm.org/show_bug.cgi?id=40172 upstream. |
nikic
self-assigned this
Dec 31, 2018
nikic
added
the
I-unsound 💥
label
Dec 31, 2018
This comment has been minimized.
This comment has been minimized.
|
Hi! I just wanted to report back that a fix is in the works here: https://reviews.llvm.org/D56428. |
This comment has been minimized.
This comment has been minimized.
|
Fix landed upstream (https://reviews.llvm.org/rL351127). @cuviper Do you plan to rebase the monorepo fork another time? If not we can just cherry-pick this later. |
This comment has been minimized.
This comment has been minimized.
|
@nikic Yes, I plan to rebase once more when 8.x is branched tomorrow, then I'll open a rust PR. |
This comment has been minimized.
This comment has been minimized.
|
The LLVM update has landed and includes this fix. Would be great if you can confirm that the original problem is fixed on current nightly. |
This comment has been minimized.
This comment has been minimized.
BonsaiDen
commented
Jan 30, 2019
|
@nikic Problem is indeed fixed on 1.34.0-nightly |
This comment has been minimized.
This comment has been minimized.
|
Great, thanks! |
BonsaiDen commentedDec 27, 2018
I've tested this with current nightly, beta and stable as well as nightlies all the way back to october (haven't tried anything before that).
Expected Output:
a: false / t.a: false / both check for: (2 & 1) == 1(Correct)Actual Output:
a: false / t.a: true / both check for: (2 & 1) == 1(Incorrect)Note: You can plug the code below into the https://github.com/rustwasm/rust-webpack-template for running it.
For some reason the two different
(byte & 1) == 1expression generate different results.Note: Inlining everything by replacing
bytewith2produces the correct output.Also Note: In my real program there are more strange things that happen after this like (
for i in vectornot actually iterating over the contents of the vector) but I was unable to reduce those to a test case :(For comparison, here's the same code (just without the WASM stuff) that produces the expected output
a: false / t.a: false / both check for: (2 & 1) == 1when invoked via a simplecargo run: