Rollup merge of #22969 - dotdash:no_alloca_zeroed, r=huonw
Its only user was lvalue_scratch_datum which is called with zero=true anymore, so it's effectively unused.
This commit is contained in:
commit
873d312d62
@ -1000,7 +1000,7 @@ pub fn trans_drop_flag_ptr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, r: &Repr<'tcx
|
||||
let fcx = bcx.fcx;
|
||||
let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
|
||||
let scratch = unpack_datum!(bcx, datum::lvalue_scratch_datum(
|
||||
bcx, tcx.types.bool, "drop_flag", false,
|
||||
bcx, tcx.types.bool, "drop_flag",
|
||||
cleanup::CustomScope(custom_cleanup_scope), (), |_, bcx, _| bcx
|
||||
));
|
||||
bcx = fold_variants(bcx, r, val, |variant_cx, st, value| {
|
||||
|
@ -1203,21 +1203,6 @@ pub fn alloca_no_lifetime(cx: Block, ty: Type, name: &str) -> ValueRef {
|
||||
Alloca(cx, ty, name)
|
||||
}
|
||||
|
||||
pub fn alloca_zeroed<'blk, 'tcx>(cx: Block<'blk, 'tcx>, ty: Ty<'tcx>,
|
||||
name: &str) -> ValueRef {
|
||||
let llty = type_of::type_of(cx.ccx(), ty);
|
||||
if cx.unreachable.get() {
|
||||
unsafe {
|
||||
return llvm::LLVMGetUndef(llty.ptr_to().to_ref());
|
||||
}
|
||||
}
|
||||
let p = alloca_no_lifetime(cx, llty, name);
|
||||
let b = cx.fcx.ccx.builder();
|
||||
b.position_before(cx.fcx.alloca_insert_pt.get().unwrap());
|
||||
memzero(&b, p, ty);
|
||||
p
|
||||
}
|
||||
|
||||
// Creates the alloca slot which holds the pointer to the slot for the final return value
|
||||
pub fn make_return_slot_pointer<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>,
|
||||
output_type: Ty<'tcx>) -> ValueRef {
|
||||
@ -1547,7 +1532,6 @@ fn create_datums_for_fn_args_under_call_abi<'blk, 'tcx>(
|
||||
datum::lvalue_scratch_datum(bcx,
|
||||
arg_ty,
|
||||
"tupled_args",
|
||||
false,
|
||||
tuple_args_scope_id,
|
||||
(),
|
||||
|(),
|
||||
|
@ -195,24 +195,18 @@ pub fn immediate_rvalue_bcx<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
|
||||
/// Allocates temporary space on the stack using alloca() and returns a by-ref Datum pointing to
|
||||
/// it. The memory will be dropped upon exit from `scope`. The callback `populate` should
|
||||
/// initialize the memory. If `zero` is true, the space will be zeroed when it is allocated; this
|
||||
/// is not necessary unless `bcx` does not dominate the end of `scope`.
|
||||
/// initialize the memory.
|
||||
pub fn lvalue_scratch_datum<'blk, 'tcx, A, F>(bcx: Block<'blk, 'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
name: &str,
|
||||
zero: bool,
|
||||
scope: cleanup::ScopeId,
|
||||
arg: A,
|
||||
populate: F)
|
||||
-> DatumBlock<'blk, 'tcx, Lvalue> where
|
||||
F: FnOnce(A, Block<'blk, 'tcx>, ValueRef) -> Block<'blk, 'tcx>,
|
||||
{
|
||||
let scratch = if zero {
|
||||
alloca_zeroed(bcx, ty, name)
|
||||
} else {
|
||||
let llty = type_of::type_of(bcx.ccx(), ty);
|
||||
alloca(bcx, llty, name)
|
||||
};
|
||||
let llty = type_of::type_of(bcx.ccx(), ty);
|
||||
let scratch = alloca(bcx, llty, name);
|
||||
|
||||
// Subtle. Populate the scratch memory *before* scheduling cleanup.
|
||||
let bcx = populate(arg, bcx, scratch);
|
||||
@ -383,7 +377,7 @@ impl<'tcx> Datum<'tcx, Rvalue> {
|
||||
|
||||
ByValue => {
|
||||
lvalue_scratch_datum(
|
||||
bcx, self.ty, name, false, scope, self,
|
||||
bcx, self.ty, name, scope, self,
|
||||
|this, bcx, llval| this.store_to(bcx, llval))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user