You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong codegen for wasm32 with opt-level >= 2 #50754
I've bisected which nightly caused the regression.
The last nightly it was working is rustc 1.26.0-nightly (e026b59cf 2018-03-03).
The next nightly already has this issue: rustc 1.26.0-nightly (259e4a678 2018-03-04).
The diff between these is e026b59...259e4a6, which contains #48125, the other merged PRs seem irrelevant to this.
So it might actually be a bug in LLD.
Yes, it gives 65525 on a Linux host target with all opt-levels, it also gives 65525 on wasm32 with opt-level = 0,1,"s","z" but gives 65530 with opt-level = 2,3 independently from the lto setting. And it seems that before switching to LLD on wasm32 it used to give 65525 with all opt-levels as well.
This has now been fixed in upstream LLVM and I've backported it to our fork with rust-lang/llvm#116, so all that's needed now is a PR to this repo to update the LLVM submodule!
Activity
CryZe commentedon May 15, 2018
It looks like this is indeed a codegen bug and it didn't use to happen (doesn't happen on webassembly.studio). It's also not related to wasm-bindgen.
ngg commentedon May 15, 2018
I've bisected which nightly caused the regression.
The last nightly it was working is
rustc 1.26.0-nightly (e026b59cf 2018-03-03).The next nightly already has this issue:
rustc 1.26.0-nightly (259e4a678 2018-03-04).The diff between these is e026b59...259e4a6, which contains #48125, the other merged PRs seem irrelevant to this.
So it might actually be a bug in LLD.
kennytm commentedon May 15, 2018
cc @alexcrichton #48125 Potential LLD codegen bug ↑
alexcrichton commentedon May 16, 2018
Thanks for the report @ngg! To confirm the bug here is that the browser shows 65530 while the answer is supposed to be 65525, right?
CryZe commentedon May 16, 2018
Yeah
ngg commentedon May 16, 2018
Yes, it gives 65525 on a Linux host target with all opt-levels, it also gives 65525 on wasm32 with
opt-level = 0,1,"s","z"but gives 65530 withopt-level = 2,3independently from theltosetting. And it seems that before switching to LLD on wasm32 it used to give 65525 with all opt-levels as well.kennytm commentedon May 16, 2018
Somewhat minimized, removing the wasm-bindgen dependency
Test shim:
Execute with:
With opt-level ≥ 2, the output would be 15 (wrong). With opt-level ≤ 1, the output would be 65525 (correct).
alexcrichton commentedon May 16, 2018
I believe this is an LLVM bug after reduction, and I've opened an upstream bug report
alexcrichton commentedon May 16, 2018
For posterity the smallest reduction I've got so far (IR-wise) is:
alexcrichton commentedon May 17, 2018
This has now been fixed in upstream LLVM and I've backported it to our fork with rust-lang/llvm#116, so all that's needed now is a PR to this repo to update the LLVM submodule!
ngg commentedon May 21, 2018
Thanks! This is now working, even for the original aes-soft wrapper.