Auto merge of #80114 - GuillaumeGomez:rollup-gszr5kn, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - #80006 (BTreeMap: more expressive local variables in merge) - #80022 (BTreeSet: simplify implementation of pop_first/pop_last) - #80035 (Optimization for bool's PartialOrd impl) - #80040 (Always run intrinsics lowering pass) - #80047 (Use more symbols in rustdoc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
caeb3335c0
21 changed files with 97 additions and 100 deletions
|
@ -83,9 +83,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
return;
|
||||
}
|
||||
|
||||
sym::unreachable => {
|
||||
return;
|
||||
}
|
||||
sym::va_start => bx.va_start(args[0].immediate()),
|
||||
sym::va_end => bx.va_end(args[0].immediate()),
|
||||
sym::size_of_val => {
|
||||
|
@ -106,8 +103,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
bx.const_usize(bx.layout_of(tp_ty).align.abi.bytes())
|
||||
}
|
||||
}
|
||||
sym::size_of
|
||||
| sym::pref_align_of
|
||||
sym::pref_align_of
|
||||
| sym::min_align_of
|
||||
| sym::needs_drop
|
||||
| sym::type_id
|
||||
|
@ -119,10 +115,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
.unwrap();
|
||||
OperandRef::from_const(bx, value, ret_ty).immediate_or_packed_pair(bx)
|
||||
}
|
||||
// Effectively no-op
|
||||
sym::forget => {
|
||||
return;
|
||||
}
|
||||
sym::offset => {
|
||||
let ptr = args[0].immediate();
|
||||
let offset = args[1].immediate();
|
||||
|
@ -218,9 +210,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
sym::add_with_overflow
|
||||
| sym::sub_with_overflow
|
||||
| sym::mul_with_overflow
|
||||
| sym::wrapping_add
|
||||
| sym::wrapping_sub
|
||||
| sym::wrapping_mul
|
||||
| sym::unchecked_div
|
||||
| sym::unchecked_rem
|
||||
| sym::unchecked_shl
|
||||
|
@ -254,9 +243,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
|
||||
return;
|
||||
}
|
||||
sym::wrapping_add => bx.add(args[0].immediate(), args[1].immediate()),
|
||||
sym::wrapping_sub => bx.sub(args[0].immediate(), args[1].immediate()),
|
||||
sym::wrapping_mul => bx.mul(args[0].immediate(), args[1].immediate()),
|
||||
sym::exact_div => {
|
||||
if signed {
|
||||
bx.exactsdiv(args[0].immediate(), args[1].immediate())
|
||||
|
|
|
@ -61,12 +61,11 @@ crate fn eval_nullary_intrinsic<'tcx>(
|
|||
ConstValue::Slice { data: alloc, start: 0, end: alloc.len() }
|
||||
}
|
||||
sym::needs_drop => ConstValue::from_bool(tp_ty.needs_drop(tcx, param_env)),
|
||||
sym::size_of | sym::min_align_of | sym::pref_align_of => {
|
||||
sym::min_align_of | sym::pref_align_of => {
|
||||
let layout = tcx.layout_of(param_env.and(tp_ty)).map_err(|e| err_inval!(Layout(e)))?;
|
||||
let n = match name {
|
||||
sym::pref_align_of => layout.align.pref.bytes(),
|
||||
sym::min_align_of => layout.align.abi.bytes(),
|
||||
sym::size_of => layout.size.bytes(),
|
||||
_ => bug!(),
|
||||
};
|
||||
ConstValue::from_machine_usize(n, &tcx)
|
||||
|
@ -125,7 +124,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
let (dest, ret) = match ret {
|
||||
None => match intrinsic_name {
|
||||
sym::transmute => throw_ub_format!("transmuting to uninhabited type"),
|
||||
sym::unreachable => throw_ub!(Unreachable),
|
||||
sym::abort => M::abort(self, "the program aborted execution".to_owned())?,
|
||||
// Unsupported diverging intrinsic.
|
||||
_ => return Ok(false),
|
||||
|
@ -160,13 +158,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
sym::min_align_of
|
||||
| sym::pref_align_of
|
||||
| sym::needs_drop
|
||||
| sym::size_of
|
||||
| sym::type_id
|
||||
| sym::type_name
|
||||
| sym::variant_count => {
|
||||
let gid = GlobalId { instance, promoted: None };
|
||||
let ty = match intrinsic_name {
|
||||
sym::min_align_of | sym::pref_align_of | sym::size_of | sym::variant_count => {
|
||||
sym::min_align_of | sym::pref_align_of | sym::variant_count => {
|
||||
self.tcx.types.usize
|
||||
}
|
||||
sym::needs_drop => self.tcx.types.bool,
|
||||
|
@ -212,28 +209,16 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
let out_val = numeric_intrinsic(intrinsic_name, bits, kind)?;
|
||||
self.write_scalar(out_val, dest)?;
|
||||
}
|
||||
sym::wrapping_add
|
||||
| sym::wrapping_sub
|
||||
| sym::wrapping_mul
|
||||
| sym::add_with_overflow
|
||||
| sym::sub_with_overflow
|
||||
| sym::mul_with_overflow => {
|
||||
sym::add_with_overflow | sym::sub_with_overflow | sym::mul_with_overflow => {
|
||||
let lhs = self.read_immediate(args[0])?;
|
||||
let rhs = self.read_immediate(args[1])?;
|
||||
let (bin_op, ignore_overflow) = match intrinsic_name {
|
||||
sym::wrapping_add => (BinOp::Add, true),
|
||||
sym::wrapping_sub => (BinOp::Sub, true),
|
||||
sym::wrapping_mul => (BinOp::Mul, true),
|
||||
sym::add_with_overflow => (BinOp::Add, false),
|
||||
sym::sub_with_overflow => (BinOp::Sub, false),
|
||||
sym::mul_with_overflow => (BinOp::Mul, false),
|
||||
let bin_op = match intrinsic_name {
|
||||
sym::add_with_overflow => BinOp::Add,
|
||||
sym::sub_with_overflow => BinOp::Sub,
|
||||
sym::mul_with_overflow => BinOp::Mul,
|
||||
_ => bug!("Already checked for int ops"),
|
||||
};
|
||||
if ignore_overflow {
|
||||
self.binop_ignore_overflow(bin_op, lhs, rhs, dest)?;
|
||||
} else {
|
||||
self.binop_with_overflow(bin_op, lhs, rhs, dest)?;
|
||||
}
|
||||
self.binop_with_overflow(bin_op, lhs, rhs, dest)?;
|
||||
}
|
||||
sym::saturating_add | sym::saturating_sub => {
|
||||
let l = self.read_immediate(args[0])?;
|
||||
|
|
|
@ -364,6 +364,7 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc
|
|||
// `AddRetag` needs to run after `ElaborateDrops`. Otherwise it should run fairly late,
|
||||
// but before optimizations begin.
|
||||
&add_retag::AddRetag,
|
||||
&lower_intrinsics::LowerIntrinsics,
|
||||
&simplify::SimplifyCfg::new("elaborate-drops"),
|
||||
// `Deaggregator` is conceptually part of MIR building, some backends rely on it happening
|
||||
// and it can help optimizations.
|
||||
|
@ -392,7 +393,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
|||
|
||||
// The main optimizations that we do on MIR.
|
||||
let optimizations: &[&dyn MirPass<'tcx>] = &[
|
||||
&lower_intrinsics::LowerIntrinsics,
|
||||
&remove_unneeded_drops::RemoveUnneededDrops,
|
||||
&match_branches::MatchBranchSimplification,
|
||||
// inst combine is after MatchBranchSimplification to clean up Ne(_1, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue