1
Fork 0

PR Feedback: Don't put SSA-only types in CValues

This commit is contained in:
Scott McMurray 2021-05-31 10:26:08 -07:00
parent 039a3bafec
commit 3d2869c6ff
2 changed files with 9 additions and 9 deletions

View file

@ -437,12 +437,6 @@ impl<'tcx> CPlace<'tcx> {
| (types::F32, types::I32)
| (types::I64, types::F64)
| (types::F64, types::I64) => fx.bcx.ins().bitcast(dst_ty, data),
// Widen an abstract SSA boolean to something that can be stored in memory
(types::B1, types::I8 | types::I16 | types::I32 | types::I64 | types::I128) => {
fx.bcx.ins().bint(dst_ty, data)
}
_ if src_ty.is_vector() && dst_ty.is_vector() => {
fx.bcx.ins().raw_bitcast(dst_ty, data)
}
@ -459,6 +453,10 @@ impl<'tcx> CPlace<'tcx> {
ptr.store(fx, data, MemFlags::trusted());
ptr.load(fx, dst_ty, MemFlags::trusted())
}
// `CValue`s should never contain SSA-only types, so if you ended
// up here having seen an error like `B1 -> I8`, then before
// calling `write_cvalue` you need to add a `bint` instruction.
_ => unreachable!("write_cvalue_transmute: {:?} -> {:?}", src_ty, dst_ty),
};
//fx.bcx.set_val_label(data, cranelift_codegen::ir::ValueLabel::new(var.index()));