Skip to content

Commit a5f11c7

Browse files
committed
Avoid CValue::const_val in a couple of places
1 parent 0e50c9e commit a5f11c7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/base.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,10 @@ fn codegen_stmt<'tcx>(
767767
NullOp::SizeOf => layout.size.bytes(),
768768
NullOp::AlignOf => layout.align.abi.bytes(),
769769
};
770-
let val = CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), val.into());
770+
let val = CValue::by_val(
771+
fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(val).unwrap()),
772+
fx.layout_of(fx.tcx.types.usize),
773+
);
771774
lval.write_cvalue(fx, val);
772775
}
773776
Rvalue::Aggregate(ref kind, ref operands) => {

src/intrinsics/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
11031103

11041104
fx.bcx.ins().call_indirect(f_sig, f, &[data]);
11051105

1106-
let layout = ret.layout();
1107-
let ret_val = CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size));
1106+
let layout = fx.layout_of(fx.tcx.types.i32);
1107+
let ret_val = CValue::by_val(fx.bcx.ins().iconst(types::I32, 0), layout);
11081108
ret.write_cvalue(fx, ret_val);
11091109
}
11101110

0 commit comments

Comments
 (0)