Avoid CValue::const_val in a couple of places

This commit is contained in:
bjorn3 2023-03-27 16:30:50 +00:00
parent 0e50c9e4f3
commit a5f11c7aeb
2 changed files with 6 additions and 3 deletions

View File

@ -767,7 +767,10 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
NullOp::SizeOf => layout.size.bytes(),
NullOp::AlignOf => layout.align.abi.bytes(),
};
let val = CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), val.into());
let val = CValue::by_val(
fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(val).unwrap()),
fx.layout_of(fx.tcx.types.usize),
);
lval.write_cvalue(fx, val);
}
Rvalue::Aggregate(ref kind, ref operands) => {

View File

@ -1103,8 +1103,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
fx.bcx.ins().call_indirect(f_sig, f, &[data]);
let layout = ret.layout();
let ret_val = CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size));
let layout = fx.layout_of(fx.tcx.types.i32);
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I32, 0), layout);
ret.write_cvalue(fx, ret_val);
}