Cranelift: aarch64: fix undefined dest reg in f32x4.splat case. (#5987)

One of the cases for a splat operation, as updated in #5370, wrote to
a temp reg but then only conditionally transformed the temp into the
final destination register. In another codepath, `rd` was left
undefined. This causes a panic later when regalloc2 verifies SSA
properties of its input (here, value not def'd before use).

Fixes #5985.
This commit is contained in:
Chris Fallin
2023-03-10 16:22:29 -08:00
committed by GitHub
parent 52896e020d
commit 264089e29d
2 changed files with 35 additions and 7 deletions

View File

@@ -416,22 +416,30 @@ impl Inst {
size
}]
} else if let Some(imm) = widen_32_bit_pattern(pattern, lane_size) {
let tmp = alloc_tmp(types::I64X2);
let mut insts = smallvec![Inst::VecDupImm {
rd: tmp,
imm,
invert: false,
size: VectorSize::Size64x2,
}];
let mut insts = smallvec![];
// TODO: Implement support for 64-bit scalar MOVI; we zero-extend the
// lower 64 bits instead.
if !size.is_128bits() {
let tmp = alloc_tmp(types::I64X2);
insts.push(Inst::VecDupImm {
rd: tmp,
imm,
invert: false,
size: VectorSize::Size64x2,
});
insts.push(Inst::FpuExtend {
rd,
rn: tmp.to_reg(),
size: ScalarSize::Size64,
});
} else {
insts.push(Inst::VecDupImm {
rd,
imm,
invert: false,
size: VectorSize::Size64x2,
});
}
insts