Register allocation error
orangeC23 opened this issue · comments
Describe the bug
Register allocation error when executing tmp.py file.
Both macOS and ubuntu20.04 encountered the problem.
Steps to reproduce
The wat file:
(module
(type (;0;) (func (param i32) (result i32 i32)))
(func (;0;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
v128.const i32x4 0x2d2d2d2d 0x2d2d2d2d 0x2d2d2d2d 0xd42d2d2d
f64x2.trunc
i16x8.extend_high_i8x16_s
i16x8.extend_high_i8x16_s
i16x8.extend_low_i8x16_u
i32x4.extend_high_i16x8_s
i16x8.abs
v128.not
i32x4.extend_high_i16x8_s
i16x8.abs
i16x8.abs
f32x4.demote_f64x2_zero
f64x2.sqrt
f64x2.sqrt
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.extend_low_i8x16_s
i16x8.extend_low_i8x16_u
f64x2.sqrt
f64x2.sqrt
i8x16.neg
i16x8.extend_high_i8x16_s
i16x8.extend_low_i8x16_u
i16x8.abs
v128.not
i16x8.abs
i16x8.abs
f32x4.demote_f64x2_zero
f64x2.sqrt
f64x2.sqrt
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.extend_low_i8x16_s
i16x8.extend_high_i8x16_s
i16x8.extend_high_i8x16_s
i16x8.extend_high_i8x16_s
i32x4.extadd_pairwise_i16x8_u
i64x2.extend_high_i32x4_s
i16x8.abs
loop (result externref) ;; label = @1
global.get 7
i32.eqz
if ;; label = @2
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
table.size 1
table.get 1
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
br 0 (;@1;)
drop
end
drop
drop
i32.const 757935405
i32.const 757935405)
(func (;1;) (type 0) (param i32) (result i32 i32)
(local f64 f64 f64 f64 f64 f64 f64 f64 f64 f32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
memory.size
global.set 0
f32.const -0x1.b7b7b6p+56 (;=-123769510000000000;)
i32.trunc_sat_f32_s
memory.grow
i32.load8_s offset=1697735729
if (result f32) ;; label = @1
f32.const -0x1.41fe4p+79 (;=-760284860000000000000000;)
i64.trunc_f32_s
global.get 0
v128.const i32x4 0xe7e7e7e7 0x2d2d2de7 0x2d2d2d2d 0xe7e72d2d
f32x4.floor
i16x8.extract_lane_u 7
f32.convert_i32_u
i64.const -2604246507696870099
f32.const -0x1.cfce4p+80 (;=-2190260300000000000000000;)
f64.promote_f32
f32.demote_f64
f64.promote_f32
f32.demote_f64
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.5bcfcep-37 (;=0.000000000009885404;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.2ba5a4p-85 (;=0.000000000000000000000000030256618;)
local.set 10
local.set 10
local.set 10
local.set 10
f32.const 0x1.5a5a5ap-101 (;=0.0000000000000000000000000000005336412;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.cfce5ap+80 (;=-2190262200000000000000000;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
local.tee 10
local.set 10
local.set 10
local.set 10
local.set 10
i64.const 3255307779245711603
local.get 1
global.get 5
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.cfcfcep-36 (;=0.000000000026364645;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.a85a5ap+38 (;=-455645500000;)
local.set 10
local.set 10
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.2a2a2ap-85 (;=0.00000000000000000000000003010694;)
local.set 10
local.set 10
f32.const 0x1.5a5a5ap-101 (;=0.0000000000000000000000000000005336412;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.cfce5ap+80 (;=-2190262200000000000000000;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
local.tee 10
local.set 10
local.set 10
local.set 10
local.set 10
i64.const 3255307779245711603
local.get 1
global.get 5
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
f32.const 0x1.cfcfcep-36 (;=0.000000000026364645;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f32.const -0x1.a85a5ap+38 (;=-455645500000;)
local.tee 10
local.tee 10
memory.size
f32.convert_i32_u
memory.size
i64.load16_s offset=1634085221
i64.ctz
table.size 1
v128.load64_splat offset=552069095
f64x2.sqrt
f64x2.sqrt
f64x2.sqrt
i16x8.abs
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
f32.const -0x1.5a5a5ap+79 (;=-817802750000000000000000;)
else
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
end
drop
i32.const 757983207
i32.const 757935405)
(func (;2;) (type 0) (param i32) (result i32 i32)
(local f64 f64 funcref f32 f32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
f64.const -0x1.7e7e7e7e7e7e7p+639 (;=-3408411520223639500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;)
f32.demote_f64
f64.const 0x1.d2d2d2d2d2d2dp-301 (;=0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044759381595361623;)
f32.const 0x1.5a5a5ap-37 (;=0.0000000000098439425;)
f64.const -0x1.2d42d2d2d2d2dp+302 (;=-9588743049676975000000000000000000000000000000000000000000000000000000000000000000000000000;)
f64.sqrt
i32.const -606395173
i32.const 1835102836
i64.load8_u offset=2173185325
i64.extend8_s
i64.store16 offset=419430398
f32.const 0x1.ccc27p-45 (;=0.000000000000051154583;)
f32.abs
f32.neg
local.tee 5
i64.trunc_f32_u
f32.const -0x1.cfcfcep+80 (;=-2190289000000000000000000;)
i32.trunc_sat_f32_s
i64.load offset=757935405 align=1
i64.eq
i64.load offset=757935405 align=1
i64x2.splat
i16x8.extend_high_i8x16_s
i32x4.all_true
i64.load offset=2173775149 align=1
i64.clz
i64.clz
global.get 0
v128.const i32x4 0xe7e7e7e7 0x2d2d2d2d 0x2d2d2d2d 0x2d2d2d2d
i32x4.neg
i16x8.extend_high_i8x16_u
i32x4.neg
i32x4.neg
i32x4.extend_high_i16x8_u
ref.null func
memory.size
v128.load32_splat offset=1667575909 align=2
i32x4.extend_low_i16x8_u
i16x8.extend_high_i8x16_s
global.get 0
v128.load8x8_s offset=808597554
i16x8.mul
i8x16.extract_lane_s 13
i64.load offset=770941057 align=2
i64.clz
i64.clz
i64.clz
global.get 0
v128.const i32x4 0x00000ae7 0xe7e7e700 0x2d2d2d2d 0x302d2d2d
global.get 5
f64.abs
f64.const 0x1.1333437303634p-140 (;=0.000000000000000000000000000000000000000000771275369652005;)
f32.const 0x1.5a5a5ap-15 (;=0.000041288487;)
f32.abs
f32.neg
f32.abs
f64.const 0x1.d2d2d2d2d2d2dp-301 (;=0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044759381595361623;)
f32.const -0x1.a5a5a8p+38 (;=-452740120000;)
i32.trunc_f32_u
v128.load64_splat offset=3688618971
i64x2.extract_lane 1
i32.wrap_i64
memory.size
i64.extend_i32_s
drop
v128.load64_splat offset=3676372768
f64x2.sqrt
i16x8.abs
i16x8.abs
i16x8.abs
i16x8.abs
f32x4.convert_i32x4_u
i16x8.extend_high_i8x16_s
f64.const 0x1.de7e7e7e7e7e7p-301 (;=0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004587836613524566;)
local.tee 2
local.tee 2
local.tee 2
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
drop
i32.const 0
i32.const 0)
(func (;3;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;4;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;5;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;6;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;7;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;8;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;9;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(func (;10;) (type 0) (param i32) (result i32 i32)
global.get 7
i32.eqz
if ;; label = @1
unreachable
end
global.get 7
i32.const 1
i32.sub
global.set 7
i32.const 0
i32.const 0)
(table (;0;) 695263 861962 funcref)
(table (;1;) 83188 739473 externref)
(memory (;0;) 59136 60894)
(global (;0;) (mut i32) (i32.const 757935405))
(global (;1;) (mut f64) (f64.const -0x1.7e7e7e7e72d2dp+639 (;=-3408411520199426000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;)))
(global (;2;) (mut i32) (i32.const 757983207))
(global (;3;) (mut f64) (f64.const -0x1.9612d2d2d2d2dp+442 (;=-18014524297354837000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;)))
(global (;4;) (mut f64) (f64.const 0x1.d2d2d2d2d2d2dp-301 (;=0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044759381595361623;)))
(global (;5;) (mut f64) (f64.const -0x1.7e7e7e7e7e7e7p+639 (;=-3408411520223639500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;)))
(global (;6;) (mut i32) (i32.const -757935827))
(global (;7;) (mut i32) (i32.const 1000)))
The python file:
import os
from wasmer import engine, wat2wasm, Store, Module, Instance
# from wasmer_compiler_cranelift import Compiler
# from wasmer_compiler_llvm import Compiler
from wasmer_compiler_singlepass import Compiler
engine = engine.Universal(Compiler)
# Create a store, that holds the engine.
store = Store(engine)
# Let's compile the Wasm module with the Cranelift compiler.
__dir__ = os.path.dirname(os.path.realpath(__file__))
module = Module(Store(), open(__dir__ + '/../tmp.wasm', 'rb').read())
# Let's instantiate the Wasm module.
instance = Instance(module)
Execute:
wat2wasm tmp.wasm
pythonn tmp.py
Expected behavior
Successfully load the Wasm module and instantiate the instance.
Actual behavior
thread '' panicked at 'register allocation: Analysis(EntryLiveinValues([v66V]))', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-codegen-0.76.0/src/machinst/compile.rs:96:10
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
Traceback (most recent call last):
File "tmp.py", line 15, in
module = Module(Store(), open(dir + '/../tmp.wasm', 'rb').read())
pyo3_runtime.PanicException: register allocation: Analysis(EntryLiveinValues([v66V]))