Allow spec constant convert ops. (#2399)

This commit is contained in:
charles-r-earp 2023-11-07 12:54:48 -08:00 committed by GitHub
parent 87781d389e
commit f2c68d71c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,8 +341,14 @@ fn evaluate_spec_constant_op(
let constant_to_instruction = |constant_id: Id| -> SmallVec<[Instruction; 1]> {
let constant = &constants[&constant_id];
debug_assert_eq!(constant.type_id, result_type_id);
if !matches!(
opcode,
SpecConstantInstruction::UConvert { .. }
| SpecConstantInstruction::SConvert { .. }
| SpecConstantInstruction::FConvert { .. }
) {
debug_assert_eq!(constant.type_id, result_type_id);
}
match constant.value {
ConstantValue::Scalar(value) => smallvec![scalar_constant_to_instruction(
result_type_id,