x64: fix register allocation panic due to load-coalesced value (#3954)

Fuzz testing identified a lowering case for CLIF's `icmp` in which the
double use of a loaded operand resulted in a register allocation error.
This change manually adds `put_in_xmm` to avoid load-coalescing these
values and includes a CLIF filetest to trigger this issue. Closes #3951.

I opened #3953 to discuss a way in which this kind of mistake (i.e.,
forgetting to add `put_in_*` in certain situations) could be avoided.
This commit is contained in:
Andrew Brown
2022-03-21 18:46:27 -07:00
committed by GitHub
parent 3bfbb3226e
commit 4d5bd5f90e
4 changed files with 171 additions and 142 deletions

View File

@@ -0,0 +1,19 @@
test compile
set enable_simd
target x86_64 skylake
;; Compile a CLIF version of the register allocation issue identified in
;; https://github.com/bytecodealliance/wasmtime/issues/3951.
function %check_issue_3951(i64 vmctx) -> i8x16 fast {
gv0 = vmctx
block0(v0: i64):
v2 = global_value.i64 gv0
v3 = load.i8x16 notrap aligned v2+8
v4 = global_value.i64 gv0
v5 = load.i8x16 notrap aligned v4+8
v6 = icmp ugt v3, v5
v7 = raw_bitcast.i8x16 v6
jump block1(v7)
block1(v1: i8x16):
return v1
}