[llvm-bugs] [Bug 40805] New: [WebAssembly] codegen bug during instruction selection

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 21 08:43:46 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40805

            Bug ID: 40805
           Summary: [WebAssembly] codegen bug during instruction selection
           Product: libraries
           Version: 8.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: alex at crichton.co
                CC: dan433584 at gmail.com, llvm-bugs at lists.llvm.org,
                    tlively at google.com

First reported upstream to rust-lang/rust -
https://github.com/rust-lang/rust/issues/58548 - I've managed to reduce this a
little more from the Rust issue report. It looks like during "WebAssembly
Instruction Selection" on the `run_test` function a bug is generated. 

All the relevant files for this should be in
https://gist.github.com/alexcrichton/f0098f0505ce1476a2bef944b03ff06e, notably:

* lib.rs -
https://gist.github.com/alexcrichton/f0098f0505ce1476a2bef944b03ff06e#file-lib-rs
- the original Rust source used to generate this buggy program
* foo.ll -
https://gist.github.com/alexcrichton/f0098f0505ce1476a2bef944b03ff06e#file-foo-ll
- the LLVM IR generated by rustc with LTO (to avoid references to the Rust
standard library). 
* foo.js -
https://gist.github.com/alexcrichton/f0098f0505ce1476a2bef944b03ff06e#file-foo-js
- auxiliary JS for node.js to run the output wasm binary
* build.sh -
https://gist.github.com/alexcrichton/f0098f0505ce1476a2bef944b03ff06e#file-build-sh
- the invocations of `llc` and `wasm-ld` used to produce a WebAssembly binary.

Using `-opt-bisect-limit` I've found that the pass "WebAssembly Instruction
Selection on function (run_test)" looks to be causing the issue here (different
behavior in optimized vs non-optimized mode). This pass changes the final
output wasm with this diff:

https://gist.github.com/alexcrichton/5603d6a0e59d638e9ac74751d51f4cad

but I unfortunately can't really make heads or tails of where the bug is. 

If any more info is needed from our end please just let me know!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190221/9e7b1d10/attachment.html>


More information about the llvm-bugs mailing list