bytecodealliance / bytecodealliance/wasmtime
Cranelift: Unable to compile valid program with optimizations
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
👋 Hey,
I found this today when running the `cranelift-fuzzgen` fuzzer. This program compiles with `opt_level=none` but fails with `opt_level=speed`.
### `.clif` Test Case
```
test compile
set opt_level=speed
target x86_64 has_sse3 has_ssse3 has_sse41 has_sse42 has_avx has_avx2 has_fma has_popcnt has_bmi1 has_bmi2 has_lzcnt
function %a() -> i64x2 {
const0 = 0x00000000000000000000000000000000
block0:
v19 = iconst.i8 96
v30 = vconst.i64x2 const0
v31 = ishl v30, v19 ; v30 = const0, v19 = 96
v35 = sshr v31, v19 ; v19 = 96
return v35
}
```
### Steps to Reproduce
* `clif-util test ./the-above.clif`
### Expected Results
The test to pass.
### Actual Results
```
afonso@DESKTOP-1AHKMV2:~/git/wasmtime/cranelift$ cargo run -- test ./lmao.clif
Finished dev [unoptimized + debuginfo] target(s) in 0.14s
Running `/home/afonso/git/wasmtime/target/debug/clif-util test ./lmao.clif`
thread 'worker #0' panicked at cranelift/codegen/src/ir/instructions.rs:788:21:
The Narrower constraint only operates on floats or ints
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ERROR cranelift_filetests::concurrent > FAIL: panicked in worker #0: The Narrower constraint only operates on floats or ints
FAIL ./lmao.clif: panicked in worker #0: The Narrower constraint only operates on floats or ints
1 tests
Error: 1 failure
```
### Versions and Environment
Cranelift version or commit: main (62ad1185bcbf39a2668708c379f850e57e7ce780)
Operating system: Linux
Architecture: x86/64
### Extra Info
Bisecting this gives the first bad commit as e39c6b76f9f01b5a5383a62a2a4a12997416cbef (cc: @fitzgen), but I think that just changed the heuristics of how we apply optimizations and It feels like it might be a preexisting issue that is only surfaced by that commit.
Contributor guide
Assessment
This issue has not been assessed yet.