Skip to content

Commit

Permalink
Avoid CValue::const_val in a couple of places
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Mar 27, 2023
1 parent 0e50c9e commit a5f11c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,10 @@ fn codegen_stmt<'tcx>(
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) => {
Expand Down
4 changes: 2 additions & 2 deletions src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit a5f11c7

Please sign in to comment.