[llvm-bugs] [Bug 37488] New: wasm32: Codegen bug at O2 for llc

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 16 08:55:31 PDT 2018


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

            Bug ID: 37488
           Summary: wasm32: Codegen bug at O2 for llc
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: alex at crichton.co
                CC: llvm-bugs at lists.llvm.org

Created attachment 20310
  --> https://bugs.llvm.org/attachment.cgi?id=20310&action=edit
IR

Originally reported at https://github.com/rust-lang/rust/issues/50754 I've
reduced the test case to a smaller piece of Rust code
(https://gist.github.com/4b0396c7599d3b15dadc2c82f62b624e) which at `-C
opt-level=2` for the Rust compiler generates the attached IR.

When the attached IR is compiled to a wasm object file with O0 it generates a
different answer than when generated with O2:


    $ llc bar.ll -filetype=obj -O0 -o bar.o
    $ wasm-ld bar.o -o bar.wasm --no-entry
    $ node bar.js
    0
    $ llc bar.ll -filetype=obj -O2 -o bar.o
    $ wasm-ld bar.o -o bar.wasm --no-entry
    $ node bar.js
    65534

where `bar.js` looks like:

    const fs = require('fs');
    let buf = fs.readFileSync('bar.wasm');
    let m = new WebAssembly.Module(buf);
    let inst = new WebAssembly.Instance(m, {});
    console.log(inst.exports.test());

I unfortunately haven't been able to track this down much farther, but I was
hoping that y'all could help me reduce from here!

-- 
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/20180516/912e1917/attachment.html>


More information about the llvm-bugs mailing list