cranelift: Generate the correct souper size for comparisons in LHSes (#5659)

This commit is contained in:
Nick Fitzgerald
2023-01-30 15:32:47 -08:00
committed by GitHub
parent f488d93c5a
commit e4fa355866

View File

@@ -528,9 +528,16 @@ fn souper_type_of(dfg: &ir::DataFlowGraph, val: ir::Value) -> Option<ast::Type>
let ty = dfg.value_type(val);
assert!(ty.is_int());
assert_eq!(ty.lane_count(), 1);
Some(ast::Type {
width: ty.bits().try_into().unwrap(),
})
let width = match dfg.value_def(val).inst() {
Some(inst)
if dfg.insts[inst].opcode() == ir::Opcode::IcmpImm
|| dfg.insts[inst].opcode() == ir::Opcode::Icmp =>
{
1
}
_ => ty.bits().try_into().unwrap(),
};
Some(ast::Type { width })
}
#[derive(Debug)]