Skip to content

Bad optimization by wasm-opt #8013

@mkustermann

Description

@mkustermann

I think there's some optimization bug in wasm-opt

See the attached wasmopt_bug.tar.gz file. Reproduction instructions:

# Unpack
% tar xvzf wasmopt_bug.tar.gz 
pkg/dart2wasm/bin/run_wasm.js
dowhile.O1.mjs
dowhile.O1.wasm
dowhile.O1.bad.mjs
dowhile.O1.bad.wasm

# Run the unoptimized version
% third_party/d8/linux/x64/d8  $PWD/pkg/dart2wasm/bin/run_wasm.js -- $PWD/dowhile.O1.mjs $PWD/dowhile.O1.wasm
=> works

# Optimize via wasm-opt
% out/ReleaseX64/wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-exception-handling --enable-nontrapping-float-to-int --enable-sign-ext --enable-bulk-memory --enable-threads '--no-inline=*<noInline>*' --closed-world --traps-never-happen --type-unfinalizing -Os --type-ssa --gufa -Os --type-merging -Os --type-finalizing --minimize-rec-groups -g dowhile.O1.wasm -o dowhile.O1.bad.wasm

# Run the optimized version
% third_party/d8/linux/x64/d8  $PWD/pkg/dart2wasm/bin/run_wasm.js -- $PWD/dowhile.O1.bad.mjs $PWD/dowhile.O1.bad.wasm
=> spins infinitely

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions