Auto merge of #116270 - cjgillot:gvn-aggregate, r=oli-obk,RalfJung

See through aggregates in GVN

This PR is extracted from https://github.com/rust-lang/rust/pull/111344

The first 2 commit are cleanups to avoid repeated work. I propose to stop removing useless assignments as part of this pass, and let a later `SimplifyLocals` do it. This makes tests easier to read (among others).

The next 3 commits add a constant folding mechanism to the GVN pass, presented in https://github.com/rust-lang/rust/pull/116012. ~This pass is designed to only use global allocations, to avoid any risk of accidental modification of the stored state.~

The following commits implement opportunistic simplifications, in particular:
- projections of aggregates: `MyStruct { x: a }.x` gets replaced by `a`, works with enums too;
- projections of arrays: `[a, b][0]` becomes `a`;
- projections of repeat expressions: `[a; N][x]` becomes `a`;
- transform arrays of equal operands into a repeat rvalue.

Fixes https://github.com/rust-lang/miri/issues/3090

r? `@oli-obk`
This commit is contained in:
bors 2023-10-29 14:50:53 +00:00
commit 83c9732e0c
51 changed files with 4333 additions and 2622 deletions

View File

@ -1,7 +1,8 @@
//! Functions for reading and writing discriminants of multi-variant layouts (enums and coroutines).
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
use rustc_middle::{mir, ty};
use rustc_middle::mir;
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt};
use rustc_middle::ty::{self, Ty};
use rustc_target::abi::{self, TagEncoding};
use rustc_target::abi::{VariantIdx, Variants};
@ -244,11 +245,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
pub fn discriminant_for_variant(
&self,
layout: TyAndLayout<'tcx>,
ty: Ty<'tcx>,
variant: VariantIdx,
) -> InterpResult<'tcx, ImmTy<'tcx, M::Provenance>> {
let discr_layout = self.layout_of(layout.ty.discriminant_ty(*self.tcx))?;
let discr_value = match layout.ty.discriminant_for_variant(*self.tcx, variant) {
let discr_layout = self.layout_of(ty.discriminant_ty(*self.tcx))?;
let discr_value = match ty.discriminant_for_variant(*self.tcx, variant) {
Some(discr) => {
// This type actually has discriminants.
assert_eq!(discr.ty, discr_layout.ty);

View File

@ -450,6 +450,42 @@ pub fn intern_const_alloc_recursive<
Ok(())
}
/// Intern `ret`. This function assumes that `ret` references no other allocation.
#[instrument(level = "debug", skip(ecx))]
pub fn intern_const_alloc_for_constprop<
'mir,
'tcx: 'mir,
T,
M: CompileTimeMachine<'mir, 'tcx, T>,
>(
ecx: &mut InterpCx<'mir, 'tcx, M>,
alloc_id: AllocId,
) -> InterpResult<'tcx, ()> {
// Move allocation to `tcx`.
let Some((_, mut alloc)) = ecx.memory.alloc_map.remove(&alloc_id) else {
// Pointer not found in local memory map. It is either a pointer to the global
// map, or dangling.
if ecx.tcx.try_get_global_alloc(alloc_id).is_none() {
throw_ub!(DeadLocal)
}
// The constant is already in global memory. Do nothing.
return Ok(());
};
alloc.mutability = Mutability::Not;
// We are not doing recursive interning, so we don't currently support provenance.
// (If this assertion ever triggers, we should just implement a
// proper recursive interning loop.)
assert!(alloc.provenance().ptrs().is_empty());
// Link the alloc id to the actual allocation
let alloc = ecx.tcx.mk_const_alloc(alloc);
ecx.tcx.set_alloc_id_memory(alloc_id, alloc);
Ok(())
}
impl<'mir, 'tcx: 'mir, M: super::intern::CompileTimeMachine<'mir, 'tcx, !>>
InterpCx<'mir, 'tcx, M>
{

View File

@ -218,7 +218,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
sym::discriminant_value => {
let place = self.deref_pointer(&args[0])?;
let variant = self.read_discriminant(&place)?;
let discr = self.discriminant_for_variant(place.layout, variant)?;
let discr = self.discriminant_for_variant(place.layout.ty, variant)?;
self.write_immediate(*discr, dest)?;
}
sym::exact_div => {

View File

@ -1011,7 +1011,7 @@ impl<'tcx, 'a, Prov: Provenance, Extra, Bytes: AllocBytes> AllocRef<'a, 'tcx, Pr
}
/// Returns whether the allocation has provenance anywhere in the range of the `AllocRef`.
pub(crate) fn has_provenance(&self) -> bool {
pub fn has_provenance(&self) -> bool {
!self.alloc.provenance().range_empty(self.range, &self.tcx)
}
}

View File

@ -21,7 +21,9 @@ mod visitor;
pub use rustc_middle::mir::interpret::*; // have all the `interpret` symbols in one place: here
pub use self::eval_context::{Frame, FrameInfo, InterpCx, StackPopCleanup};
pub use self::intern::{intern_const_alloc_recursive, InternKind};
pub use self::intern::{
intern_const_alloc_for_constprop, intern_const_alloc_recursive, InternKind,
};
pub use self::machine::{compile_time_machine, AllocMap, Machine, MayLeak, StackPopJump};
pub use self::memory::{AllocKind, AllocRef, AllocRefMut, FnVal, Memory, MemoryKind};
pub use self::operand::{ImmTy, Immediate, OpTy, Readable};

View File

@ -169,6 +169,16 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> {
ImmTy { imm: val.into(), layout }
}
#[inline]
pub fn from_scalar_pair(a: Scalar<Prov>, b: Scalar<Prov>, layout: TyAndLayout<'tcx>) -> Self {
debug_assert!(
matches!(layout.abi, Abi::ScalarPair(..)),
"`ImmTy::from_scalar_pair` on non-scalar-pair layout"
);
let imm = Immediate::ScalarPair(a, b);
ImmTy { imm, layout }
}
#[inline(always)]
pub fn from_immediate(imm: Immediate<Prov>, layout: TyAndLayout<'tcx>) -> Self {
debug_assert!(

View File

@ -297,7 +297,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Discriminant(place) => {
let op = self.eval_place_to_op(place, None)?;
let variant = self.read_discriminant(&op)?;
let discr = self.discriminant_for_variant(op.layout, variant)?;
let discr = self.discriminant_for_variant(op.layout.ty, variant)?;
self.write_immediate(*discr, &dest)?;
}
}

View File

@ -172,6 +172,24 @@ impl<'tcx> ConstValue<'tcx> {
let end = end.try_into().unwrap();
Some(data.inner().inspect_with_uninit_and_ptr_outside_interpreter(start..end))
}
/// Check if a constant may contain provenance information. This is used by MIR opts.
/// Can return `true` even if there is no provenance.
pub fn may_have_provenance(&self, tcx: TyCtxt<'tcx>, size: Size) -> bool {
match *self {
ConstValue::ZeroSized | ConstValue::Scalar(Scalar::Int(_)) => return false,
ConstValue::Scalar(Scalar::Ptr(..)) => return true,
// It's hard to find out the part of the allocation we point to;
// just conservatively check everything.
ConstValue::Slice { data, meta: _ } => !data.inner().provenance().ptrs().is_empty(),
ConstValue::Indirect { alloc_id, offset } => !tcx
.global_alloc(alloc_id)
.unwrap_memory()
.inner()
.provenance()
.range_empty(super::AllocRange::from(offset..offset + size), &tcx),
}
}
}
///////////////////////////////////////////////////////////////////////////
@ -485,6 +503,38 @@ impl<'tcx> Const<'tcx> {
_ => Self::Ty(c),
}
}
/// Return true if any evaluation of this constant always returns the same value,
/// taking into account even pointer identity tests.
pub fn is_deterministic(&self) -> bool {
// Some constants may generate fresh allocations for pointers they contain,
// so using the same constant twice can yield two different results:
// - valtrees purposefully generate new allocations
// - ConstValue::Slice also generate new allocations
match self {
Const::Ty(c) => match c.kind() {
ty::ConstKind::Param(..) => true,
// A valtree may be a reference. Valtree references correspond to a
// different allocation each time they are evaluated. Valtrees for primitive
// types are fine though.
ty::ConstKind::Value(_) => c.ty().is_primitive(),
ty::ConstKind::Unevaluated(..) | ty::ConstKind::Expr(..) => false,
// Should not appear in runtime MIR.
ty::ConstKind::Infer(..)
| ty::ConstKind::Bound(..)
| ty::ConstKind::Placeholder(..)
| ty::ConstKind::Error(..) => bug!(),
},
Const::Unevaluated(..) => false,
// If the same slice appears twice in the MIR, we cannot guarantee that we will
// give the same `AllocId` to the data.
Const::Val(ConstValue::Slice { .. }, _) => false,
Const::Val(
ConstValue::ZeroSized | ConstValue::Scalar(_) | ConstValue::Indirect { .. },
_,
) => true,
}
}
}
/// An unevaluated (potentially generic) constant used in MIR.

View File

@ -406,7 +406,8 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
TrackElem::Variant(idx) => self.ecx.project_downcast(op, idx).ok(),
TrackElem::Discriminant => {
let variant = self.ecx.read_discriminant(op).ok()?;
let discr_value = self.ecx.discriminant_for_variant(op.layout, variant).ok()?;
let discr_value =
self.ecx.discriminant_for_variant(op.layout.ty, variant).ok()?;
Some(discr_value.into())
}
TrackElem::DerefLen => {
@ -507,7 +508,8 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
return None;
}
let enum_ty_layout = self.tcx.layout_of(self.param_env.and(enum_ty)).ok()?;
let discr_value = self.ecx.discriminant_for_variant(enum_ty_layout, variant_index).ok()?;
let discr_value =
self.ecx.discriminant_for_variant(enum_ty_layout.ty, variant_index).ok()?;
Some(discr_value.to_scalar())
}
@ -854,7 +856,7 @@ impl<'tcx> Visitor<'tcx> for OperandCollector<'tcx, '_, '_, '_> {
}
}
struct DummyMachine;
pub(crate) struct DummyMachine;
impl<'mir, 'tcx: 'mir> rustc_const_eval::interpret::Machine<'mir, 'tcx> for DummyMachine {
rustc_const_eval::interpret::compile_time_machine!(<'mir, 'tcx>);

View File

@ -52,19 +52,59 @@
//! _a = *_b // _b is &Freeze
//! _c = *_b // replaced by _c = _a
//! ```
//!
//! # Determinism of constant propagation
//!
//! When registering a new `Value`, we attempt to opportunistically evaluate it as a constant.
//! The evaluated form is inserted in `evaluated` as an `OpTy` or `None` if evaluation failed.
//!
//! The difficulty is non-deterministic evaluation of MIR constants. Some `Const` can have
//! different runtime values each time they are evaluated. This is the case with
//! `Const::Slice` which have a new pointer each time they are evaluated, and constants that
//! contain a fn pointer (`AllocId` pointing to a `GlobalAlloc::Function`) pointing to a different
//! symbol in each codegen unit.
//!
//! Meanwhile, we want to be able to read indirect constants. For instance:
//! ```
//! static A: &'static &'static u8 = &&63;
//! fn foo() -> u8 {
//! **A // We want to replace by 63.
//! }
//! fn bar() -> u8 {
//! b"abc"[1] // We want to replace by 'b'.
//! }
//! ```
//!
//! The `Value::Constant` variant stores a possibly unevaluated constant. Evaluating that constant
//! may be non-deterministic. When that happens, we assign a disambiguator to ensure that we do not
//! merge the constants. See `duplicate_slice` test in `gvn.rs`.
//!
//! Second, when writing constants in MIR, we do not write `Const::Slice` or `Const`
//! that contain `AllocId`s.
use rustc_const_eval::interpret::{intern_const_alloc_for_constprop, MemoryKind};
use rustc_const_eval::interpret::{ImmTy, InterpCx, OpTy, Projectable, Scalar};
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
use rustc_data_structures::graph::dominators::Dominators;
use rustc_hir::def::DefKind;
use rustc_index::bit_set::BitSet;
use rustc_index::IndexVec;
use rustc_macros::newtype_index;
use rustc_middle::mir::interpret::GlobalAlloc;
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_target::abi::{VariantIdx, FIRST_VARIANT};
use rustc_middle::ty::adjustment::PointerCoercion;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeAndMut};
use rustc_span::def_id::DefId;
use rustc_span::DUMMY_SP;
use rustc_target::abi::{self, Abi, Size, VariantIdx, FIRST_VARIANT};
use std::borrow::Cow;
use crate::dataflow_const_prop::DummyMachine;
use crate::ssa::{AssignedValue, SsaLocals};
use crate::MirPass;
use either::Either;
pub struct GVN;
@ -118,22 +158,33 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let data = &mut body.basic_blocks.as_mut_preserves_cfg()[bb];
state.visit_basic_block_data(bb, data);
}
let any_replacement = state.any_replacement;
// For each local that is reused (`y` above), we remove its storage statements do avoid any
// difficulty. Those locals are SSA, so should be easy to optimize by LLVM without storage
// statements.
StorageRemover { tcx, reused_locals: state.reused_locals }.visit_body_preserves_cfg(body);
if any_replacement {
crate::simplify::remove_unused_definitions(body);
}
}
newtype_index! {
struct VnIndex {}
}
/// Computing the aggregate's type can be quite slow, so we only keep the minimal amount of
/// information to reconstruct it when needed.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum AggregateTy<'tcx> {
/// Invariant: this must not be used for an empty array.
Array,
Tuple,
Def(DefId, ty::GenericArgsRef<'tcx>),
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
enum AddressKind {
Ref(BorrowKind),
Address(Mutability),
}
#[derive(Debug, PartialEq, Eq, Hash)]
enum Value<'tcx> {
// Root values.
@ -141,15 +192,21 @@ enum Value<'tcx> {
/// The `usize` is a counter incremented by `new_opaque`.
Opaque(usize),
/// Evaluated or unevaluated constant value.
Constant(Const<'tcx>),
Constant {
value: Const<'tcx>,
/// Some constants do not have a deterministic value. To avoid merging two instances of the
/// same `Const`, we assign them an additional integer index.
disambiguator: usize,
},
/// An aggregate value, either tuple/closure/struct/enum.
/// This does not contain unions, as we cannot reason with the value.
Aggregate(Ty<'tcx>, VariantIdx, Vec<VnIndex>),
Aggregate(AggregateTy<'tcx>, VariantIdx, Vec<VnIndex>),
/// This corresponds to a `[value; count]` expression.
Repeat(VnIndex, ty::Const<'tcx>),
/// The address of a place.
Address {
place: Place<'tcx>,
kind: AddressKind,
/// Give each borrow and pointer a different provenance, so we don't merge them.
provenance: usize,
},
@ -177,6 +234,7 @@ enum Value<'tcx> {
struct VnState<'body, 'tcx> {
tcx: TyCtxt<'tcx>,
ecx: InterpCx<'tcx, 'tcx, DummyMachine>,
param_env: ty::ParamEnv<'tcx>,
local_decls: &'body LocalDecls<'tcx>,
/// Value stored in each local.
@ -184,13 +242,14 @@ struct VnState<'body, 'tcx> {
/// First local to be assigned that value.
rev_locals: FxHashMap<VnIndex, Vec<Local>>,
values: FxIndexSet<Value<'tcx>>,
/// Values evaluated as constants if possible.
evaluated: IndexVec<VnIndex, Option<OpTy<'tcx>>>,
/// Counter to generate different values.
/// This is an option to stop creating opaques during replacement.
next_opaque: Option<usize>,
ssa: &'body SsaLocals,
dominators: &'body Dominators<BasicBlock>,
reused_locals: BitSet<Local>,
any_replacement: bool,
}
impl<'body, 'tcx> VnState<'body, 'tcx> {
@ -203,23 +262,30 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
) -> Self {
VnState {
tcx,
ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine),
param_env,
local_decls,
locals: IndexVec::from_elem(None, local_decls),
rev_locals: FxHashMap::default(),
values: FxIndexSet::default(),
evaluated: IndexVec::new(),
next_opaque: Some(0),
ssa,
dominators,
reused_locals: BitSet::new_empty(local_decls.len()),
any_replacement: false,
}
}
#[instrument(level = "trace", skip(self), ret)]
fn insert(&mut self, value: Value<'tcx>) -> VnIndex {
let (index, _) = self.values.insert_full(value);
VnIndex::from_usize(index)
let (index, new) = self.values.insert_full(value);
let index = VnIndex::from_usize(index);
if new {
let evaluated = self.eval_to_const(index);
let _index = self.evaluated.push(evaluated);
debug_assert_eq!(index, _index);
}
index
}
/// Create a new `Value` for which we have no information at all, except that it is distinct
@ -234,9 +300,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
/// Create a new `Value::Address` distinct from all the others.
#[instrument(level = "trace", skip(self), ret)]
fn new_pointer(&mut self, place: Place<'tcx>) -> Option<VnIndex> {
fn new_pointer(&mut self, place: Place<'tcx>, kind: AddressKind) -> Option<VnIndex> {
let next_opaque = self.next_opaque.as_mut()?;
let value = Value::Address { place, provenance: *next_opaque };
let value = Value::Address { place, kind, provenance: *next_opaque };
*next_opaque += 1;
Some(self.insert(value))
}
@ -258,6 +324,343 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}
}
fn insert_constant(&mut self, value: Const<'tcx>) -> Option<VnIndex> {
let disambiguator = if value.is_deterministic() {
// The constant is deterministic, no need to disambiguate.
0
} else {
// Multiple mentions of this constant will yield different values,
// so assign a different `disambiguator` to ensure they do not get the same `VnIndex`.
let next_opaque = self.next_opaque.as_mut()?;
let disambiguator = *next_opaque;
*next_opaque += 1;
disambiguator
};
Some(self.insert(Value::Constant { value, disambiguator }))
}
fn insert_scalar(&mut self, scalar: Scalar, ty: Ty<'tcx>) -> VnIndex {
self.insert_constant(Const::from_scalar(self.tcx, scalar, ty))
.expect("scalars are deterministic")
}
#[instrument(level = "trace", skip(self), ret)]
fn eval_to_const(&mut self, value: VnIndex) -> Option<OpTy<'tcx>> {
use Value::*;
let op = match *self.get(value) {
Opaque(_) => return None,
// Do not bother evaluating repeat expressions. This would uselessly consume memory.
Repeat(..) => return None,
Constant { ref value, disambiguator: _ } => {
self.ecx.eval_mir_constant(value, None, None).ok()?
}
Aggregate(kind, variant, ref fields) => {
let fields = fields
.iter()
.map(|&f| self.evaluated[f].as_ref())
.collect::<Option<Vec<_>>>()?;
let ty = match kind {
AggregateTy::Array => {
assert!(fields.len() > 0);
Ty::new_array(self.tcx, fields[0].layout.ty, fields.len() as u64)
}
AggregateTy::Tuple => {
Ty::new_tup_from_iter(self.tcx, fields.iter().map(|f| f.layout.ty))
}
AggregateTy::Def(def_id, args) => {
self.tcx.type_of(def_id).instantiate(self.tcx, args)
}
};
let variant = if ty.is_enum() { Some(variant) } else { None };
let ty = self.ecx.layout_of(ty).ok()?;
if ty.is_zst() {
ImmTy::uninit(ty).into()
} else if matches!(ty.abi, Abi::Scalar(..) | Abi::ScalarPair(..)) {
let dest = self.ecx.allocate(ty, MemoryKind::Stack).ok()?;
let variant_dest = if let Some(variant) = variant {
self.ecx.project_downcast(&dest, variant).ok()?
} else {
dest.clone()
};
for (field_index, op) in fields.into_iter().enumerate() {
let field_dest = self.ecx.project_field(&variant_dest, field_index).ok()?;
self.ecx.copy_op(op, &field_dest, /*allow_transmute*/ false).ok()?;
}
self.ecx.write_discriminant(variant.unwrap_or(FIRST_VARIANT), &dest).ok()?;
self.ecx.alloc_mark_immutable(dest.ptr().provenance.unwrap()).ok()?;
dest.into()
} else {
return None;
}
}
Projection(base, elem) => {
let value = self.evaluated[base].as_ref()?;
let elem = match elem {
ProjectionElem::Deref => ProjectionElem::Deref,
ProjectionElem::Downcast(name, read_variant) => {
ProjectionElem::Downcast(name, read_variant)
}
ProjectionElem::Field(f, ty) => ProjectionElem::Field(f, ty),
ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
ProjectionElem::ConstantIndex { offset, min_length, from_end }
}
ProjectionElem::Subslice { from, to, from_end } => {
ProjectionElem::Subslice { from, to, from_end }
}
ProjectionElem::OpaqueCast(ty) => ProjectionElem::OpaqueCast(ty),
ProjectionElem::Subtype(ty) => ProjectionElem::Subtype(ty),
// This should have been replaced by a `ConstantIndex` earlier.
ProjectionElem::Index(_) => return None,
};
self.ecx.project(value, elem).ok()?
}
Address { place, kind, provenance: _ } => {
if !place.is_indirect_first_projection() {
return None;
}
let local = self.locals[place.local]?;
let pointer = self.evaluated[local].as_ref()?;
let mut mplace = self.ecx.deref_pointer(pointer).ok()?;
for proj in place.projection.iter().skip(1) {
// We have no call stack to associate a local with a value, so we cannot interpret indexing.
if matches!(proj, ProjectionElem::Index(_)) {
return None;
}
mplace = self.ecx.project(&mplace, proj).ok()?;
}
let pointer = mplace.to_ref(&self.ecx);
let ty = match kind {
AddressKind::Ref(bk) => Ty::new_ref(
self.tcx,
self.tcx.lifetimes.re_erased,
ty::TypeAndMut { ty: mplace.layout.ty, mutbl: bk.to_mutbl_lossy() },
),
AddressKind::Address(mutbl) => {
Ty::new_ptr(self.tcx, TypeAndMut { ty: mplace.layout.ty, mutbl })
}
};
let layout = self.ecx.layout_of(ty).ok()?;
ImmTy::from_immediate(pointer, layout).into()
}
Discriminant(base) => {
let base = self.evaluated[base].as_ref()?;
let variant = self.ecx.read_discriminant(base).ok()?;
let discr_value =
self.ecx.discriminant_for_variant(base.layout.ty, variant).ok()?;
discr_value.into()
}
Len(slice) => {
let slice = self.evaluated[slice].as_ref()?;
let usize_layout = self.ecx.layout_of(self.tcx.types.usize).unwrap();
let len = slice.len(&self.ecx).ok()?;
let imm = ImmTy::try_from_uint(len, usize_layout)?;
imm.into()
}
NullaryOp(null_op, ty) => {
let layout = self.ecx.layout_of(ty).ok()?;
if let NullOp::SizeOf | NullOp::AlignOf = null_op && layout.is_unsized() {
return None;
}
let val = match null_op {
NullOp::SizeOf => layout.size.bytes(),
NullOp::AlignOf => layout.align.abi.bytes(),
NullOp::OffsetOf(fields) => layout
.offset_of_subfield(&self.ecx, fields.iter().map(|f| f.index()))
.bytes(),
};
let usize_layout = self.ecx.layout_of(self.tcx.types.usize).unwrap();
let imm = ImmTy::try_from_uint(val, usize_layout)?;
imm.into()
}
UnaryOp(un_op, operand) => {
let operand = self.evaluated[operand].as_ref()?;
let operand = self.ecx.read_immediate(operand).ok()?;
let (val, _) = self.ecx.overflowing_unary_op(un_op, &operand).ok()?;
val.into()
}
BinaryOp(bin_op, lhs, rhs) => {
let lhs = self.evaluated[lhs].as_ref()?;
let lhs = self.ecx.read_immediate(lhs).ok()?;
let rhs = self.evaluated[rhs].as_ref()?;
let rhs = self.ecx.read_immediate(rhs).ok()?;
let (val, _) = self.ecx.overflowing_binary_op(bin_op, &lhs, &rhs).ok()?;
val.into()
}
CheckedBinaryOp(bin_op, lhs, rhs) => {
let lhs = self.evaluated[lhs].as_ref()?;
let lhs = self.ecx.read_immediate(lhs).ok()?;
let rhs = self.evaluated[rhs].as_ref()?;
let rhs = self.ecx.read_immediate(rhs).ok()?;
let (val, overflowed) = self.ecx.overflowing_binary_op(bin_op, &lhs, &rhs).ok()?;
let tuple = Ty::new_tup_from_iter(
self.tcx,
[val.layout.ty, self.tcx.types.bool].into_iter(),
);
let tuple = self.ecx.layout_of(tuple).ok()?;
ImmTy::from_scalar_pair(val.to_scalar(), Scalar::from_bool(overflowed), tuple)
.into()
}
Cast { kind, value, from: _, to } => match kind {
CastKind::IntToInt | CastKind::IntToFloat => {
let value = self.evaluated[value].as_ref()?;
let value = self.ecx.read_immediate(value).ok()?;
let to = self.ecx.layout_of(to).ok()?;
let res = self.ecx.int_to_int_or_float(&value, to).ok()?;
res.into()
}
CastKind::FloatToFloat | CastKind::FloatToInt => {
let value = self.evaluated[value].as_ref()?;
let value = self.ecx.read_immediate(value).ok()?;
let to = self.ecx.layout_of(to).ok()?;
let res = self.ecx.float_to_float_or_int(&value, to).ok()?;
res.into()
}
CastKind::Transmute => {
let value = self.evaluated[value].as_ref()?;
let to = self.ecx.layout_of(to).ok()?;
// `offset` for immediates only supports scalar/scalar-pair ABIs,
// so bail out if the target is not one.
if value.as_mplace_or_imm().is_right() {
match (value.layout.abi, to.abi) {
(Abi::Scalar(..), Abi::Scalar(..)) => {}
(Abi::ScalarPair(..), Abi::ScalarPair(..)) => {}
_ => return None,
}
}
value.offset(Size::ZERO, to, &self.ecx).ok()?
}
_ => return None,
},
};
Some(op)
}
fn project(
&mut self,
place: PlaceRef<'tcx>,
value: VnIndex,
proj: PlaceElem<'tcx>,
) -> Option<VnIndex> {
let proj = match proj {
ProjectionElem::Deref => {
let ty = place.ty(self.local_decls, self.tcx).ty;
if let Some(Mutability::Not) = ty.ref_mutability()
&& let Some(pointee_ty) = ty.builtin_deref(true)
&& pointee_ty.ty.is_freeze(self.tcx, self.param_env)
{
// An immutable borrow `_x` always points to the same value for the
// lifetime of the borrow, so we can merge all instances of `*_x`.
ProjectionElem::Deref
} else {
return None;
}
}
ProjectionElem::Downcast(name, index) => ProjectionElem::Downcast(name, index),
ProjectionElem::Field(f, ty) => {
if let Value::Aggregate(_, _, fields) = self.get(value) {
return Some(fields[f.as_usize()]);
} else if let Value::Projection(outer_value, ProjectionElem::Downcast(_, read_variant)) = self.get(value)
&& let Value::Aggregate(_, written_variant, fields) = self.get(*outer_value)
// This pass is not aware of control-flow, so we do not know whether the
// replacement we are doing is actually reachable. We could be in any arm of
// ```
// match Some(x) {
// Some(y) => /* stuff */,
// None => /* other */,
// }
// ```
//
// In surface rust, the current statement would be unreachable.
//
// However, from the reference chapter on enums and RFC 2195,
// accessing the wrong variant is not UB if the enum has repr.
// So it's not impossible for a series of MIR opts to generate
// a downcast to an inactive variant.
&& written_variant == read_variant
{
return Some(fields[f.as_usize()]);
}
ProjectionElem::Field(f, ty)
}
ProjectionElem::Index(idx) => {
if let Value::Repeat(inner, _) = self.get(value) {
return Some(*inner);
}
let idx = self.locals[idx]?;
ProjectionElem::Index(idx)
}
ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
match self.get(value) {
Value::Repeat(inner, _) => {
return Some(*inner);
}
Value::Aggregate(AggregateTy::Array, _, operands) => {
let offset = if from_end {
operands.len() - offset as usize
} else {
offset as usize
};
return operands.get(offset).copied();
}
_ => {}
};
ProjectionElem::ConstantIndex { offset, min_length, from_end }
}
ProjectionElem::Subslice { from, to, from_end } => {
ProjectionElem::Subslice { from, to, from_end }
}
ProjectionElem::OpaqueCast(ty) => ProjectionElem::OpaqueCast(ty),
ProjectionElem::Subtype(ty) => ProjectionElem::Subtype(ty),
};
Some(self.insert(Value::Projection(value, proj)))
}
/// Simplify the projection chain if we know better.
#[instrument(level = "trace", skip(self))]
fn simplify_place_projection(&mut self, place: &mut Place<'tcx>, location: Location) {
// If the projection is indirect, we treat the local as a value, so can replace it with
// another local.
if place.is_indirect()
&& let Some(base) = self.locals[place.local]
&& let Some(new_local) = self.try_as_local(base, location)
{
place.local = new_local;
self.reused_locals.insert(new_local);
}
let mut projection = Cow::Borrowed(&place.projection[..]);
for i in 0..projection.len() {
let elem = projection[i];
if let ProjectionElem::Index(idx) = elem
&& let Some(idx) = self.locals[idx]
{
if let Some(offset) = self.evaluated[idx].as_ref()
&& let Ok(offset) = self.ecx.read_target_usize(offset)
{
projection.to_mut()[i] = ProjectionElem::ConstantIndex {
offset,
min_length: offset + 1,
from_end: false,
};
} else if let Some(new_idx) = self.try_as_local(idx, location) {
projection.to_mut()[i] = ProjectionElem::Index(new_idx);
self.reused_locals.insert(new_idx);
}
}
}
if projection.is_owned() {
place.projection = self.tcx.mk_place_elems(&projection);
}
trace!(?place);
}
/// Represent the *value* which would be read from `place`, and point `place` to a preexisting
/// place with the same value (if that already exists).
#[instrument(level = "trace", skip(self), ret)]
@ -266,6 +669,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
place: &mut Place<'tcx>,
location: Location,
) -> Option<VnIndex> {
self.simplify_place_projection(place, location);
// Invariant: `place` and `place_ref` point to the same value, even if they point to
// different memory locations.
let mut place_ref = place.as_ref();
@ -280,58 +685,18 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
place_ref = PlaceRef { local, projection: &place.projection[index..] };
}
let proj = match proj {
ProjectionElem::Deref => {
let ty = Place::ty_from(
place.local,
&place.projection[..index],
self.local_decls,
self.tcx,
)
.ty;
if let Some(Mutability::Not) = ty.ref_mutability()
&& let Some(pointee_ty) = ty.builtin_deref(true)
&& pointee_ty.ty.is_freeze(self.tcx, self.param_env)
{
// An immutable borrow `_x` always points to the same value for the
// lifetime of the borrow, so we can merge all instances of `*_x`.
ProjectionElem::Deref
} else {
return None;
}
}
ProjectionElem::Field(f, ty) => ProjectionElem::Field(f, ty),
ProjectionElem::Index(idx) => {
let idx = self.locals[idx]?;
ProjectionElem::Index(idx)
}
ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
ProjectionElem::ConstantIndex { offset, min_length, from_end }
}
ProjectionElem::Subslice { from, to, from_end } => {
ProjectionElem::Subslice { from, to, from_end }
}
ProjectionElem::Downcast(name, index) => ProjectionElem::Downcast(name, index),
ProjectionElem::OpaqueCast(ty) => ProjectionElem::OpaqueCast(ty),
ProjectionElem::Subtype(ty) => ProjectionElem::Subtype(ty),
};
value = self.insert(Value::Projection(value, proj));
let base = PlaceRef { local: place.local, projection: &place.projection[..index] };
value = self.project(base, value, proj)?;
}
if let Some(local) = self.try_as_local(value, location)
&& local != place.local
// in case we had no projection to begin with.
{
*place = local.into();
self.reused_locals.insert(local);
self.any_replacement = true;
} else if place_ref.local != place.local
|| place_ref.projection.len() < place.projection.len()
{
if let Some(new_local) = self.try_as_local(value, location) {
place_ref = PlaceRef { local: new_local, projection: &[] };
}
if place_ref.local != place.local || place_ref.projection.len() < place.projection.len() {
// By the invariant on `place_ref`.
*place = place_ref.project_deeper(&[], self.tcx);
self.reused_locals.insert(place_ref.local);
self.any_replacement = true;
}
Some(value)
@ -344,12 +709,14 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
location: Location,
) -> Option<VnIndex> {
match *operand {
Operand::Constant(ref constant) => Some(self.insert(Value::Constant(constant.const_))),
Operand::Constant(ref mut constant) => {
let const_ = constant.const_.normalize(self.tcx, self.param_env);
self.insert_constant(const_)
}
Operand::Copy(ref mut place) | Operand::Move(ref mut place) => {
let value = self.simplify_place_value(place, location)?;
if let Some(const_) = self.try_as_constant(value) {
*operand = Operand::Constant(Box::new(const_));
self.any_replacement = true;
}
Some(value)
}
@ -378,24 +745,15 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
Value::Repeat(op, amount)
}
Rvalue::NullaryOp(op, ty) => Value::NullaryOp(op, ty),
Rvalue::Aggregate(box ref kind, ref mut fields) => {
let variant_index = match *kind {
AggregateKind::Array(..)
| AggregateKind::Tuple
| AggregateKind::Closure(..)
| AggregateKind::Coroutine(..) => FIRST_VARIANT,
AggregateKind::Adt(_, variant_index, _, _, None) => variant_index,
// Do not track unions.
AggregateKind::Adt(_, _, _, _, Some(_)) => return None,
};
let fields: Option<Vec<_>> = fields
.iter_mut()
.map(|op| self.simplify_operand(op, location).or_else(|| self.new_opaque()))
.collect();
let ty = rvalue.ty(self.local_decls, self.tcx);
Value::Aggregate(ty, variant_index, fields?)
Rvalue::Aggregate(..) => return self.simplify_aggregate(rvalue, location),
Rvalue::Ref(_, borrow_kind, ref mut place) => {
self.simplify_place_projection(place, location);
return self.new_pointer(*place, AddressKind::Ref(borrow_kind));
}
Rvalue::AddressOf(mutbl, ref mut place) => {
self.simplify_place_projection(place, location);
return self.new_pointer(*place, AddressKind::Address(mutbl));
}
Rvalue::Ref(.., place) | Rvalue::AddressOf(_, place) => return self.new_pointer(place),
// Operations.
Rvalue::Len(ref mut place) => {
@ -405,6 +763,14 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
Rvalue::Cast(kind, ref mut value, to) => {
let from = value.ty(self.local_decls, self.tcx);
let value = self.simplify_operand(value, location)?;
if let CastKind::PointerCoercion(
PointerCoercion::ReifyFnPointer | PointerCoercion::ClosureFnPointer(_),
) = kind
{
// Each reification of a generic fn may get a different pointer.
// Do not try to merge them.
return self.new_opaque();
}
Value::Cast { kind, value, from, to }
}
Rvalue::BinaryOp(op, box (ref mut lhs, ref mut rhs)) => {
@ -423,6 +789,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
}
Rvalue::Discriminant(ref mut place) => {
let place = self.simplify_place_value(place, location)?;
if let Some(discr) = self.simplify_discriminant(place) {
return Some(discr);
}
Value::Discriminant(place)
}
@ -432,45 +801,182 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
debug!(?value);
Some(self.insert(value))
}
fn simplify_discriminant(&mut self, place: VnIndex) -> Option<VnIndex> {
if let Value::Aggregate(enum_ty, variant, _) = *self.get(place)
&& let AggregateTy::Def(enum_did, enum_substs) = enum_ty
&& let DefKind::Enum = self.tcx.def_kind(enum_did)
{
let enum_ty = self.tcx.type_of(enum_did).instantiate(self.tcx, enum_substs);
let discr = self.ecx.discriminant_for_variant(enum_ty, variant).ok()?;
return Some(self.insert_scalar(discr.to_scalar(), discr.layout.ty));
}
None
}
fn simplify_aggregate(
&mut self,
rvalue: &mut Rvalue<'tcx>,
location: Location,
) -> Option<VnIndex> {
let Rvalue::Aggregate(box ref kind, ref mut fields) = *rvalue else { bug!() };
let tcx = self.tcx;
if fields.is_empty() {
let is_zst = match *kind {
AggregateKind::Array(..) | AggregateKind::Tuple | AggregateKind::Closure(..) => {
true
}
// Only enums can be non-ZST.
AggregateKind::Adt(did, ..) => tcx.def_kind(did) != DefKind::Enum,
// Coroutines are never ZST, as they at least contain the implicit states.
AggregateKind::Coroutine(..) => false,
};
if is_zst {
let ty = rvalue.ty(self.local_decls, tcx);
return self.insert_constant(Const::zero_sized(ty));
}
}
let (ty, variant_index) = match *kind {
AggregateKind::Array(..) => {
assert!(!fields.is_empty());
(AggregateTy::Array, FIRST_VARIANT)
}
AggregateKind::Tuple => {
assert!(!fields.is_empty());
(AggregateTy::Tuple, FIRST_VARIANT)
}
AggregateKind::Closure(did, substs) | AggregateKind::Coroutine(did, substs, _) => {
(AggregateTy::Def(did, substs), FIRST_VARIANT)
}
AggregateKind::Adt(did, variant_index, substs, _, None) => {
(AggregateTy::Def(did, substs), variant_index)
}
// Do not track unions.
AggregateKind::Adt(_, _, _, _, Some(_)) => return None,
};
let fields: Option<Vec<_>> = fields
.iter_mut()
.map(|op| self.simplify_operand(op, location).or_else(|| self.new_opaque()))
.collect();
let fields = fields?;
if let AggregateTy::Array = ty && fields.len() > 4 {
let first = fields[0];
if fields.iter().all(|&v| v == first) {
let len = ty::Const::from_target_usize(self.tcx, fields.len().try_into().unwrap());
if let Some(const_) = self.try_as_constant(first) {
*rvalue = Rvalue::Repeat(Operand::Constant(Box::new(const_)), len);
} else if let Some(local) = self.try_as_local(first, location) {
*rvalue = Rvalue::Repeat(Operand::Copy(local.into()), len);
self.reused_locals.insert(local);
}
return Some(self.insert(Value::Repeat(first, len)));
}
}
Some(self.insert(Value::Aggregate(ty, variant_index, fields)))
}
}
fn op_to_prop_const<'tcx>(
ecx: &mut InterpCx<'_, 'tcx, DummyMachine>,
op: &OpTy<'tcx>,
) -> Option<ConstValue<'tcx>> {
// Do not attempt to propagate unsized locals.
if op.layout.is_unsized() {
return None;
}
// This constant is a ZST, just return an empty value.
if op.layout.is_zst() {
return Some(ConstValue::ZeroSized);
}
// Do not synthetize too large constants. Codegen will just memcpy them, which we'd like to avoid.
if !matches!(op.layout.abi, Abi::Scalar(..) | Abi::ScalarPair(..)) {
return None;
}
// If this constant has scalar ABI, return it as a `ConstValue::Scalar`.
if let Abi::Scalar(abi::Scalar::Initialized { .. }) = op.layout.abi
&& let Ok(scalar) = ecx.read_scalar(op)
&& scalar.try_to_int().is_ok()
{
return Some(ConstValue::Scalar(scalar));
}
// If this constant is already represented as an `Allocation`,
// try putting it into global memory to return it.
if let Either::Left(mplace) = op.as_mplace_or_imm() {
let (size, _align) = ecx.size_and_align_of_mplace(&mplace).ok()??;
// Do not try interning a value that contains provenance.
// Due to https://github.com/rust-lang/rust/issues/79738, doing so could lead to bugs.
// FIXME: remove this hack once that issue is fixed.
let alloc_ref = ecx.get_ptr_alloc(mplace.ptr(), size).ok()??;
if alloc_ref.has_provenance() {
return None;
}
let pointer = mplace.ptr().into_pointer_or_addr().ok()?;
let (alloc_id, offset) = pointer.into_parts();
intern_const_alloc_for_constprop(ecx, alloc_id).ok()?;
if matches!(ecx.tcx.global_alloc(alloc_id), GlobalAlloc::Memory(_)) {
// `alloc_id` may point to a static. Codegen will choke on an `Indirect` with anything
// by `GlobalAlloc::Memory`, so do fall through to copying if needed.
// FIXME: find a way to treat this more uniformly
// (probably by fixing codegen)
return Some(ConstValue::Indirect { alloc_id, offset });
}
}
// Everything failed: create a new allocation to hold the data.
let alloc_id =
ecx.intern_with_temp_alloc(op.layout, |ecx, dest| ecx.copy_op(op, dest, false)).ok()?;
let value = ConstValue::Indirect { alloc_id, offset: Size::ZERO };
// Check that we do not leak a pointer.
// Those pointers may lose part of their identity in codegen.
// FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed.
if ecx.tcx.global_alloc(alloc_id).unwrap_memory().inner().provenance().ptrs().is_empty() {
return Some(value);
}
None
}
impl<'tcx> VnState<'_, 'tcx> {
/// If `index` is a `Value::Constant`, return the `Constant` to be put in the MIR.
fn try_as_constant(&mut self, index: VnIndex) -> Option<ConstOperand<'tcx>> {
if let Value::Constant(const_) = *self.get(index) {
// Some constants may contain pointers. We need to preserve the provenance of these
// pointers, but not all constants guarantee this:
// - valtrees purposefully do not;
// - ConstValue::Slice does not either.
match const_ {
Const::Ty(c) => match c.kind() {
ty::ConstKind::Value(valtree) => match valtree {
// This is just an integer, keep it.
ty::ValTree::Leaf(_) => {}
ty::ValTree::Branch(_) => return None,
},
ty::ConstKind::Param(..)
| ty::ConstKind::Unevaluated(..)
| ty::ConstKind::Expr(..) => {}
// Should not appear in runtime MIR.
ty::ConstKind::Infer(..)
| ty::ConstKind::Bound(..)
| ty::ConstKind::Placeholder(..)
| ty::ConstKind::Error(..) => bug!(),
},
Const::Unevaluated(..) => {}
// If the same slice appears twice in the MIR, we cannot guarantee that we will
// give the same `AllocId` to the data.
Const::Val(ConstValue::Slice { .. }, _) => return None,
Const::Val(
ConstValue::ZeroSized | ConstValue::Scalar(_) | ConstValue::Indirect { .. },
_,
) => {}
}
Some(ConstOperand { span: rustc_span::DUMMY_SP, user_ty: None, const_ })
} else {
None
// This was already constant in MIR, do not change it.
if let Value::Constant { value, disambiguator: _ } = *self.get(index)
// If the constant is not deterministic, adding an additional mention of it in MIR will
// not give the same value as the former mention.
&& value.is_deterministic()
{
return Some(ConstOperand { span: rustc_span::DUMMY_SP, user_ty: None, const_: value });
}
let op = self.evaluated[index].as_ref()?;
if op.layout.is_unsized() {
// Do not attempt to propagate unsized locals.
return None;
}
let value = op_to_prop_const(&mut self.ecx, op)?;
// Check that we do not leak a pointer.
// Those pointers may lose part of their identity in codegen.
// FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed.
assert!(!value.may_have_provenance(self.tcx, op.layout.size));
let const_ = Const::Val(value, op.layout.ty);
Some(ConstOperand { span: rustc_span::DUMMY_SP, user_ty: None, const_ })
}
/// If there is a local which is assigned `index`, and its assignment strictly dominates `loc`,
@ -489,27 +995,32 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> {
self.tcx
}
fn visit_place(&mut self, place: &mut Place<'tcx>, _: PlaceContext, location: Location) {
self.simplify_place_projection(place, location);
}
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
self.simplify_operand(operand, location);
}
fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, location: Location) {
self.super_statement(stmt, location);
if let StatementKind::Assign(box (_, ref mut rvalue)) = stmt.kind
// Do not try to simplify a constant, it's already in canonical shape.
&& !matches!(rvalue, Rvalue::Use(Operand::Constant(_)))
&& let Some(value) = self.simplify_rvalue(rvalue, location)
{
if let Some(const_) = self.try_as_constant(value) {
*rvalue = Rvalue::Use(Operand::Constant(Box::new(const_)));
self.any_replacement = true;
} else if let Some(local) = self.try_as_local(value, location)
&& *rvalue != Rvalue::Use(Operand::Move(local.into()))
if let Some(value) = self.simplify_rvalue(rvalue, location)
{
*rvalue = Rvalue::Use(Operand::Copy(local.into()));
self.reused_locals.insert(local);
self.any_replacement = true;
if let Some(const_) = self.try_as_constant(value) {
*rvalue = Rvalue::Use(Operand::Constant(Box::new(const_)));
} else if let Some(local) = self.try_as_local(value, location)
&& *rvalue != Rvalue::Use(Operand::Move(local.into()))
{
*rvalue = Rvalue::Use(Operand::Copy(local.into()));
self.reused_locals.insert(local);
}
}
} else {
self.super_statement(stmt, location);
}
}
}

View File

@ -2,6 +2,7 @@
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![feature(box_patterns)]
#![feature(cow_is_borrowed)]
#![feature(decl_macro)]
#![feature(is_sorted)]
#![feature(let_chains)]
@ -590,6 +591,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&separate_const_switch::SeparateConstSwitch,
&const_prop::ConstProp,
&gvn::GVN,
&simplify::SimplifyLocals::AfterGVN,
&dataflow_const_prop::DataflowConstProp,
&const_debuginfo::ConstDebugInfo,
&o1(simplify_branches::SimplifyConstCondition::AfterConstProp),

View File

@ -366,6 +366,7 @@ pub fn remove_dead_blocks(body: &mut Body<'_>) {
pub enum SimplifyLocals {
BeforeConstProp,
AfterGVN,
Final,
}
@ -373,6 +374,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyLocals {
fn name(&self) -> &'static str {
match &self {
SimplifyLocals::BeforeConstProp => "SimplifyLocals-before-const-prop",
SimplifyLocals::AfterGVN => "SimplifyLocals-after-value-numbering",
SimplifyLocals::Final => "SimplifyLocals-final",
}
}

View File

@ -80,9 +80,8 @@ fn main() {
// but Miri currently uses a fixed address for monomorphic functions.
assert!(return_fn_ptr(i) == i);
assert!(return_fn_ptr(i) as unsafe fn() -> i32 == i as fn() -> i32 as unsafe fn() -> i32);
// We don't check anything for `f`. Miri gives it many different addresses
// but mir-opts can turn them into the same address.
let _val = return_fn_ptr(f) != f;
// Miri gives different addresses to different reifications of a generic function.
assert!(return_fn_ptr(f) != f);
// However, if we only turn `f` into a function pointer and use that pointer,
// it is equal to itself.
let f2 = f as fn() -> i32;

View File

@ -4,12 +4,6 @@
fn main() -> () {
let mut _0: ();
let _1: u8;
let mut _5: u8;
let mut _6: u8;
let mut _7: u8;
let mut _8: u8;
let mut _12: u32;
let mut _13: u32;
scope 1 {
- debug x => _1;
+ debug x => const 1_u8;
@ -25,34 +19,34 @@
scope 4 {
- debug sum => _4;
+ debug sum => const 6_u8;
let _9: &str;
let _5: &str;
scope 5 {
- debug s => _9;
- debug s => _5;
+ debug s => const "hello, world!";
let _14: bool;
let _15: bool;
let _16: u32;
let _8: bool;
let _9: bool;
let _10: u32;
scope 6 {
- debug ((f: (bool, bool, u32)).0: bool) => _14;
- debug ((f: (bool, bool, u32)).1: bool) => _15;
- debug ((f: (bool, bool, u32)).2: u32) => _16;
- debug ((f: (bool, bool, u32)).0: bool) => _8;
- debug ((f: (bool, bool, u32)).1: bool) => _9;
- debug ((f: (bool, bool, u32)).2: u32) => _10;
+ debug ((f: (bool, bool, u32)).0: bool) => const true;
+ debug ((f: (bool, bool, u32)).1: bool) => const false;
+ debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
let _10: std::option::Option<u16>;
let _6: std::option::Option<u16>;
scope 7 {
- debug o => _10;
- debug o => _6;
+ debug o => const Option::<u16>::Some(99_u16);
let _17: u32;
let _18: u32;
let _11: u32;
let _12: u32;
scope 8 {
- debug ((p: Point).0: u32) => _17;
- debug ((p: Point).1: u32) => _18;
- debug ((p: Point).0: u32) => _11;
- debug ((p: Point).1: u32) => _12;
+ debug ((p: Point).0: u32) => const 32_u32;
+ debug ((p: Point).1: u32) => const 32_u32;
let _11: u32;
let _7: u32;
scope 9 {
- debug a => _11;
- debug a => _7;
+ debug a => const 64_u32;
}
}
@ -69,30 +63,27 @@
_2 = const 2_u8;
_3 = const 3_u8;
StorageLive(_4);
StorageLive(_5);
_5 = const 3_u8;
_4 = const 6_u8;
StorageDead(_5);
StorageLive(_5);
_5 = const "hello, world!";
StorageLive(_8);
StorageLive(_9);
_9 = const "hello, world!";
StorageLive(_14);
StorageLive(_15);
StorageLive(_16);
_14 = const true;
_15 = const false;
_16 = const 123_u32;
StorageLive(_10);
_10 = const Option::<u16>::Some(99_u16);
_17 = const 32_u32;
_18 = const 32_u32;
StorageLive(_11);
_11 = const 64_u32;
StorageDead(_11);
StorageDead(_10);
StorageDead(_14);
StorageDead(_15);
StorageDead(_16);
_8 = const true;
_9 = const false;
_10 = const 123_u32;
StorageLive(_6);
_6 = const Option::<u16>::Some(99_u16);
_11 = const 32_u32;
_12 = const 32_u32;
StorageLive(_7);
_7 = const 64_u32;
StorageDead(_7);
StorageDead(_6);
StorageDead(_8);
StorageDead(_9);
StorageDead(_10);
StorageDead(_5);
StorageDead(_4);
return;
}

View File

@ -67,11 +67,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _3 = Add(move _4, const 0_u64);
- StorageDead(_4);
+ _3 = Add(_1, const 0_u64);
StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb1, unwind unreachable];
}
@ -80,11 +80,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
- StorageLive(_7);
- _7 = _1;
StorageLive(_7);
_7 = _1;
- _6 = Sub(move _7, const 0_u64);
- StorageDead(_7);
+ _6 = Sub(_1, const 0_u64);
StorageDead(_7);
_5 = opaque::<u64>(move _6) -> [return: bb2, unwind unreachable];
}
@ -93,11 +93,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
- StorageLive(_10);
- _10 = _1;
StorageLive(_10);
_10 = _1;
- _9 = Mul(move _10, const 0_u64);
- StorageDead(_10);
+ _9 = Mul(_1, const 0_u64);
StorageDead(_10);
_8 = opaque::<u64>(move _9) -> [return: bb3, unwind unreachable];
}
@ -106,11 +106,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
- StorageLive(_13);
- _13 = _1;
StorageLive(_13);
_13 = _1;
- _12 = Mul(move _13, const 1_u64);
- StorageDead(_13);
+ _12 = Mul(_1, const 1_u64);
StorageDead(_13);
_11 = opaque::<u64>(move _12) -> [return: bb4, unwind unreachable];
}
@ -119,17 +119,18 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_16);
- _16 = _1;
_17 = Eq(const 0_u64, const 0_u64);
StorageLive(_16);
_16 = _1;
- _17 = Eq(const 0_u64, const 0_u64);
- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind unreachable];
+ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
+ _17 = const true;
+ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
}
bb5: {
- _15 = Div(move _16, const 0_u64);
- StorageDead(_16);
+ _15 = Div(_1, const 0_u64);
StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb6, unwind unreachable];
}
@ -138,17 +139,18 @@
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
- StorageLive(_20);
- _20 = _1;
_21 = Eq(const 1_u64, const 0_u64);
StorageLive(_20);
_20 = _1;
- _21 = Eq(const 1_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind unreachable];
+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
+ _21 = const false;
+ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
}
bb7: {
- _19 = Div(move _20, const 1_u64);
- StorageDead(_20);
+ _19 = Div(_1, const 1_u64);
StorageDead(_20);
_18 = opaque::<u64>(move _19) -> [return: bb8, unwind unreachable];
}
@ -157,8 +159,8 @@
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
- StorageLive(_24);
- _24 = _1;
StorageLive(_24);
_24 = _1;
- _25 = Eq(_24, const 0_u64);
- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind unreachable];
+ _25 = Eq(_1, const 0_u64);
@ -167,8 +169,8 @@
bb9: {
- _23 = Div(const 0_u64, move _24);
- StorageDead(_24);
+ _23 = Div(const 0_u64, _1);
StorageDead(_24);
_22 = opaque::<u64>(move _23) -> [return: bb10, unwind unreachable];
}
@ -177,17 +179,18 @@
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
- StorageLive(_28);
- _28 = _1;
StorageLive(_28);
_28 = _1;
- _29 = Eq(_28, const 0_u64);
- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
+ _29 = _25;
+ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind unreachable];
}
bb11: {
- _27 = Div(const 1_u64, move _28);
- StorageDead(_28);
+ _27 = Div(const 1_u64, _1);
StorageDead(_28);
_26 = opaque::<u64>(move _27) -> [return: bb12, unwind unreachable];
}
@ -196,17 +199,18 @@
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
- StorageLive(_32);
- _32 = _1;
StorageLive(_32);
_32 = _1;
- _33 = Eq(const 0_u64, const 0_u64);
- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind unreachable];
+ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
+ _33 = const true;
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
}
bb13: {
- _31 = Rem(move _32, const 0_u64);
- StorageDead(_32);
+ _31 = Rem(_1, const 0_u64);
StorageDead(_32);
_30 = opaque::<u64>(move _31) -> [return: bb14, unwind unreachable];
}
@ -215,17 +219,18 @@
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
- StorageLive(_36);
- _36 = _1;
StorageLive(_36);
_36 = _1;
- _37 = Eq(const 1_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind unreachable];
+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
+ _37 = const false;
+ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
}
bb15: {
- _35 = Rem(move _36, const 1_u64);
- StorageDead(_36);
+ _35 = Rem(_1, const 1_u64);
StorageDead(_36);
_34 = opaque::<u64>(move _35) -> [return: bb16, unwind unreachable];
}
@ -234,17 +239,18 @@
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
- StorageLive(_40);
- _40 = _1;
StorageLive(_40);
_40 = _1;
- _41 = Eq(_40, const 0_u64);
- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
+ _41 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind unreachable];
}
bb17: {
- _39 = Rem(const 0_u64, move _40);
- StorageDead(_40);
+ _39 = Rem(const 0_u64, _1);
StorageDead(_40);
_38 = opaque::<u64>(move _39) -> [return: bb18, unwind unreachable];
}
@ -253,17 +259,18 @@
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
- StorageLive(_44);
- _44 = _1;
StorageLive(_44);
_44 = _1;
- _45 = Eq(_44, const 0_u64);
- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
+ _45 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind unreachable];
}
bb19: {
- _43 = Rem(const 1_u64, move _44);
- StorageDead(_44);
+ _43 = Rem(const 1_u64, _1);
StorageDead(_44);
_42 = opaque::<u64>(move _43) -> [return: bb20, unwind unreachable];
}
@ -272,11 +279,11 @@
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
- StorageLive(_48);
- _48 = _1;
StorageLive(_48);
_48 = _1;
- _47 = BitAnd(move _48, const 0_u64);
- StorageDead(_48);
+ _47 = BitAnd(_1, const 0_u64);
StorageDead(_48);
_46 = opaque::<u64>(move _47) -> [return: bb21, unwind unreachable];
}
@ -285,11 +292,11 @@
StorageDead(_46);
StorageLive(_49);
StorageLive(_50);
- StorageLive(_51);
- _51 = _1;
StorageLive(_51);
_51 = _1;
- _50 = BitOr(move _51, const 0_u64);
- StorageDead(_51);
+ _50 = BitOr(_1, const 0_u64);
StorageDead(_51);
_49 = opaque::<u64>(move _50) -> [return: bb22, unwind unreachable];
}
@ -298,11 +305,11 @@
StorageDead(_49);
StorageLive(_52);
StorageLive(_53);
- StorageLive(_54);
- _54 = _1;
StorageLive(_54);
_54 = _1;
- _53 = BitXor(move _54, const 0_u64);
- StorageDead(_54);
+ _53 = BitXor(_1, const 0_u64);
StorageDead(_54);
_52 = opaque::<u64>(move _53) -> [return: bb23, unwind unreachable];
}
@ -311,11 +318,11 @@
StorageDead(_52);
StorageLive(_55);
StorageLive(_56);
- StorageLive(_57);
- _57 = _1;
StorageLive(_57);
_57 = _1;
- _56 = Shr(move _57, const 0_i32);
- StorageDead(_57);
+ _56 = Shr(_1, const 0_i32);
StorageDead(_57);
_55 = opaque::<u64>(move _56) -> [return: bb24, unwind unreachable];
}
@ -324,11 +331,11 @@
StorageDead(_55);
StorageLive(_58);
StorageLive(_59);
- StorageLive(_60);
- _60 = _1;
StorageLive(_60);
_60 = _1;
- _59 = Shl(move _60, const 0_i32);
- StorageDead(_60);
+ _59 = Shl(_1, const 0_i32);
StorageDead(_60);
_58 = opaque::<u64>(move _59) -> [return: bb25, unwind unreachable];
}

View File

@ -67,11 +67,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _3 = Add(move _4, const 0_u64);
- StorageDead(_4);
+ _3 = Add(_1, const 0_u64);
StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb1, unwind continue];
}
@ -80,11 +80,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
- StorageLive(_7);
- _7 = _1;
StorageLive(_7);
_7 = _1;
- _6 = Sub(move _7, const 0_u64);
- StorageDead(_7);
+ _6 = Sub(_1, const 0_u64);
StorageDead(_7);
_5 = opaque::<u64>(move _6) -> [return: bb2, unwind continue];
}
@ -93,11 +93,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
- StorageLive(_10);
- _10 = _1;
StorageLive(_10);
_10 = _1;
- _9 = Mul(move _10, const 0_u64);
- StorageDead(_10);
+ _9 = Mul(_1, const 0_u64);
StorageDead(_10);
_8 = opaque::<u64>(move _9) -> [return: bb3, unwind continue];
}
@ -106,11 +106,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
- StorageLive(_13);
- _13 = _1;
StorageLive(_13);
_13 = _1;
- _12 = Mul(move _13, const 1_u64);
- StorageDead(_13);
+ _12 = Mul(_1, const 1_u64);
StorageDead(_13);
_11 = opaque::<u64>(move _12) -> [return: bb4, unwind continue];
}
@ -119,17 +119,18 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_16);
- _16 = _1;
_17 = Eq(const 0_u64, const 0_u64);
StorageLive(_16);
_16 = _1;
- _17 = Eq(const 0_u64, const 0_u64);
- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind continue];
+ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
+ _17 = const true;
+ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
}
bb5: {
- _15 = Div(move _16, const 0_u64);
- StorageDead(_16);
+ _15 = Div(_1, const 0_u64);
StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb6, unwind continue];
}
@ -138,17 +139,18 @@
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
- StorageLive(_20);
- _20 = _1;
_21 = Eq(const 1_u64, const 0_u64);
StorageLive(_20);
_20 = _1;
- _21 = Eq(const 1_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind continue];
+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
+ _21 = const false;
+ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
}
bb7: {
- _19 = Div(move _20, const 1_u64);
- StorageDead(_20);
+ _19 = Div(_1, const 1_u64);
StorageDead(_20);
_18 = opaque::<u64>(move _19) -> [return: bb8, unwind continue];
}
@ -157,8 +159,8 @@
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
- StorageLive(_24);
- _24 = _1;
StorageLive(_24);
_24 = _1;
- _25 = Eq(_24, const 0_u64);
- assert(!move _25, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb9, unwind continue];
+ _25 = Eq(_1, const 0_u64);
@ -167,8 +169,8 @@
bb9: {
- _23 = Div(const 0_u64, move _24);
- StorageDead(_24);
+ _23 = Div(const 0_u64, _1);
StorageDead(_24);
_22 = opaque::<u64>(move _23) -> [return: bb10, unwind continue];
}
@ -177,17 +179,18 @@
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
- StorageLive(_28);
- _28 = _1;
StorageLive(_28);
_28 = _1;
- _29 = Eq(_28, const 0_u64);
- assert(!move _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
+ _29 = _25;
+ assert(!_25, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb11, unwind continue];
}
bb11: {
- _27 = Div(const 1_u64, move _28);
- StorageDead(_28);
+ _27 = Div(const 1_u64, _1);
StorageDead(_28);
_26 = opaque::<u64>(move _27) -> [return: bb12, unwind continue];
}
@ -196,17 +199,18 @@
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
- StorageLive(_32);
- _32 = _1;
StorageLive(_32);
_32 = _1;
- _33 = Eq(const 0_u64, const 0_u64);
- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind continue];
+ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
+ _33 = const true;
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
}
bb13: {
- _31 = Rem(move _32, const 0_u64);
- StorageDead(_32);
+ _31 = Rem(_1, const 0_u64);
StorageDead(_32);
_30 = opaque::<u64>(move _31) -> [return: bb14, unwind continue];
}
@ -215,17 +219,18 @@
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
- StorageLive(_36);
- _36 = _1;
StorageLive(_36);
_36 = _1;
- _37 = Eq(const 1_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind continue];
+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
+ _37 = const false;
+ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
}
bb15: {
- _35 = Rem(move _36, const 1_u64);
- StorageDead(_36);
+ _35 = Rem(_1, const 1_u64);
StorageDead(_36);
_34 = opaque::<u64>(move _35) -> [return: bb16, unwind continue];
}
@ -234,17 +239,18 @@
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
- StorageLive(_40);
- _40 = _1;
StorageLive(_40);
_40 = _1;
- _41 = Eq(_40, const 0_u64);
- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
+ _41 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb17, unwind continue];
}
bb17: {
- _39 = Rem(const 0_u64, move _40);
- StorageDead(_40);
+ _39 = Rem(const 0_u64, _1);
StorageDead(_40);
_38 = opaque::<u64>(move _39) -> [return: bb18, unwind continue];
}
@ -253,17 +259,18 @@
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
- StorageLive(_44);
- _44 = _1;
StorageLive(_44);
_44 = _1;
- _45 = Eq(_44, const 0_u64);
- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
+ _45 = _25;
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb19, unwind continue];
}
bb19: {
- _43 = Rem(const 1_u64, move _44);
- StorageDead(_44);
+ _43 = Rem(const 1_u64, _1);
StorageDead(_44);
_42 = opaque::<u64>(move _43) -> [return: bb20, unwind continue];
}
@ -272,11 +279,11 @@
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
- StorageLive(_48);
- _48 = _1;
StorageLive(_48);
_48 = _1;
- _47 = BitAnd(move _48, const 0_u64);
- StorageDead(_48);
+ _47 = BitAnd(_1, const 0_u64);
StorageDead(_48);
_46 = opaque::<u64>(move _47) -> [return: bb21, unwind continue];
}
@ -285,11 +292,11 @@
StorageDead(_46);
StorageLive(_49);
StorageLive(_50);
- StorageLive(_51);
- _51 = _1;
StorageLive(_51);
_51 = _1;
- _50 = BitOr(move _51, const 0_u64);
- StorageDead(_51);
+ _50 = BitOr(_1, const 0_u64);
StorageDead(_51);
_49 = opaque::<u64>(move _50) -> [return: bb22, unwind continue];
}
@ -298,11 +305,11 @@
StorageDead(_49);
StorageLive(_52);
StorageLive(_53);
- StorageLive(_54);
- _54 = _1;
StorageLive(_54);
_54 = _1;
- _53 = BitXor(move _54, const 0_u64);
- StorageDead(_54);
+ _53 = BitXor(_1, const 0_u64);
StorageDead(_54);
_52 = opaque::<u64>(move _53) -> [return: bb23, unwind continue];
}
@ -311,11 +318,11 @@
StorageDead(_52);
StorageLive(_55);
StorageLive(_56);
- StorageLive(_57);
- _57 = _1;
StorageLive(_57);
_57 = _1;
- _56 = Shr(move _57, const 0_i32);
- StorageDead(_57);
+ _56 = Shr(_1, const 0_i32);
StorageDead(_57);
_55 = opaque::<u64>(move _56) -> [return: bb24, unwind continue];
}
@ -324,11 +331,11 @@
StorageDead(_55);
StorageLive(_58);
StorageLive(_59);
- StorageLive(_60);
- _60 = _1;
StorageLive(_60);
_60 = _1;
- _59 = Shl(move _60, const 0_i32);
- StorageDead(_60);
+ _59 = Shl(_1, const 0_i32);
StorageDead(_60);
_58 = opaque::<u64>(move _59) -> [return: bb25, unwind continue];
}

View File

@ -20,63 +20,12 @@
let mut _15: u64;
let mut _16: u64;
let mut _17: (u64, bool);
let _18: ();
let mut _19: u64;
let mut _20: u64;
let mut _21: bool;
let _22: ();
let mut _23: u64;
let mut _24: u64;
let mut _25: bool;
let _26: ();
let mut _27: u64;
let mut _28: u64;
let mut _29: bool;
let _30: ();
let mut _31: u64;
let mut _32: u64;
let mut _33: bool;
let _34: ();
let mut _35: u64;
let mut _36: u64;
let mut _37: bool;
let _38: ();
let mut _39: u64;
let mut _40: u64;
let mut _41: bool;
let _42: ();
let mut _43: u64;
let mut _44: u64;
let mut _45: bool;
let _46: ();
let mut _47: u64;
let mut _48: u64;
let mut _49: bool;
let _50: ();
let mut _51: u64;
let mut _52: u64;
let _53: ();
let mut _54: u64;
let mut _55: u64;
let _56: ();
let mut _57: u64;
let mut _58: u64;
let _59: ();
let mut _60: u64;
let mut _61: u64;
let mut _62: u32;
let mut _63: bool;
let _64: ();
let mut _65: u64;
let mut _66: u64;
let mut _67: u32;
let mut _68: bool;
bb0: {
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _5 = CheckedAdd(_4, const 0_u64);
- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind unreachable];
+ _5 = CheckedAdd(_1, const 0_u64);
@ -85,7 +34,7 @@
bb1: {
_3 = move (_5.0: u64);
- StorageDead(_4);
StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable];
}
@ -94,8 +43,8 @@
StorageDead(_2);
StorageLive(_6);
StorageLive(_7);
- StorageLive(_8);
- _8 = _1;
StorageLive(_8);
_8 = _1;
- _9 = CheckedSub(_8, const 0_u64);
- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind unreachable];
+ _9 = CheckedSub(_1, const 0_u64);
@ -104,7 +53,7 @@
bb3: {
_7 = move (_9.0: u64);
- StorageDead(_8);
StorageDead(_8);
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable];
}
@ -113,8 +62,8 @@
StorageDead(_6);
StorageLive(_10);
StorageLive(_11);
- StorageLive(_12);
- _12 = _1;
StorageLive(_12);
_12 = _1;
- _13 = CheckedMul(_12, const 0_u64);
- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind unreachable];
+ _13 = CheckedMul(_1, const 0_u64);
@ -123,7 +72,7 @@
bb5: {
_11 = move (_13.0: u64);
- StorageDead(_12);
StorageDead(_12);
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind unreachable];
}
@ -132,8 +81,8 @@
StorageDead(_10);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_16);
- _16 = _1;
StorageLive(_16);
_16 = _1;
- _17 = CheckedMul(_16, const 1_u64);
- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind unreachable];
+ _17 = CheckedMul(_1, const 1_u64);
@ -142,246 +91,13 @@
bb7: {
_15 = move (_17.0: u64);
- StorageDead(_16);
StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind unreachable];
}
bb8: {
StorageDead(_15);
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
- StorageLive(_20);
- _20 = _1;
_21 = Eq(const 0_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind unreachable];
+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind unreachable];
}
bb9: {
- _19 = Div(move _20, const 0_u64);
- StorageDead(_20);
+ _19 = Div(_1, const 0_u64);
_18 = opaque::<u64>(move _19) -> [return: bb10, unwind unreachable];
}
bb10: {
StorageDead(_19);
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
- StorageLive(_24);
- _24 = _1;
_25 = Eq(const 1_u64, const 0_u64);
- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind unreachable];
+ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind unreachable];
}
bb11: {
- _23 = Div(move _24, const 1_u64);
- StorageDead(_24);
+ _23 = Div(_1, const 1_u64);
_22 = opaque::<u64>(move _23) -> [return: bb12, unwind unreachable];
}
bb12: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
- StorageLive(_28);
- _28 = _1;
- _29 = Eq(_28, const 0_u64);
- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
+ _29 = Eq(_1, const 0_u64);
+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
}
bb13: {
- _27 = Div(const 0_u64, move _28);
- StorageDead(_28);
+ _27 = Div(const 0_u64, _1);
_26 = opaque::<u64>(move _27) -> [return: bb14, unwind unreachable];
}
bb14: {
StorageDead(_27);
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
- StorageLive(_32);
- _32 = _1;
- _33 = Eq(_32, const 0_u64);
- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
}
bb15: {
- _31 = Div(const 1_u64, move _32);
- StorageDead(_32);
+ _31 = Div(const 1_u64, _1);
_30 = opaque::<u64>(move _31) -> [return: bb16, unwind unreachable];
}
bb16: {
StorageDead(_31);
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
- StorageLive(_36);
- _36 = _1;
- _37 = Eq(const 0_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind unreachable];
+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind unreachable];
}
bb17: {
- _35 = Rem(move _36, const 0_u64);
- StorageDead(_36);
+ _35 = Rem(_1, const 0_u64);
_34 = opaque::<u64>(move _35) -> [return: bb18, unwind unreachable];
}
bb18: {
StorageDead(_35);
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
- StorageLive(_40);
- _40 = _1;
- _41 = Eq(const 1_u64, const 0_u64);
- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind unreachable];
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind unreachable];
}
bb19: {
- _39 = Rem(move _40, const 1_u64);
- StorageDead(_40);
+ _39 = Rem(_1, const 1_u64);
_38 = opaque::<u64>(move _39) -> [return: bb20, unwind unreachable];
}
bb20: {
StorageDead(_39);
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
- StorageLive(_44);
- _44 = _1;
- _45 = Eq(_44, const 0_u64);
- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
}
bb21: {
- _43 = Rem(const 0_u64, move _44);
- StorageDead(_44);
+ _43 = Rem(const 0_u64, _1);
_42 = opaque::<u64>(move _43) -> [return: bb22, unwind unreachable];
}
bb22: {
StorageDead(_43);
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
- StorageLive(_48);
- _48 = _1;
- _49 = Eq(_48, const 0_u64);
- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
}
bb23: {
- _47 = Rem(const 1_u64, move _48);
- StorageDead(_48);
+ _47 = Rem(const 1_u64, _1);
_46 = opaque::<u64>(move _47) -> [return: bb24, unwind unreachable];
}
bb24: {
StorageDead(_47);
StorageDead(_46);
StorageLive(_50);
StorageLive(_51);
- StorageLive(_52);
- _52 = _1;
- _51 = BitAnd(move _52, const 0_u64);
- StorageDead(_52);
+ _51 = BitAnd(_1, const 0_u64);
_50 = opaque::<u64>(move _51) -> [return: bb25, unwind unreachable];
}
bb25: {
StorageDead(_51);
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
- StorageLive(_55);
- _55 = _1;
- _54 = BitOr(move _55, const 0_u64);
- StorageDead(_55);
+ _54 = BitOr(_1, const 0_u64);
_53 = opaque::<u64>(move _54) -> [return: bb26, unwind unreachable];
}
bb26: {
StorageDead(_54);
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
- StorageLive(_58);
- _58 = _1;
- _57 = BitXor(move _58, const 0_u64);
- StorageDead(_58);
+ _57 = BitXor(_1, const 0_u64);
_56 = opaque::<u64>(move _57) -> [return: bb27, unwind unreachable];
}
bb27: {
StorageDead(_57);
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
- StorageLive(_61);
- _61 = _1;
_62 = const 0_i32 as u32 (IntToInt);
- _63 = Lt(move _62, const 64_u32);
- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
+ _63 = Lt(_62, const 64_u32);
+ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
}
bb28: {
- _60 = Shr(move _61, const 0_i32);
- StorageDead(_61);
+ _60 = Shr(_1, const 0_i32);
_59 = opaque::<u64>(move _60) -> [return: bb29, unwind unreachable];
}
bb29: {
StorageDead(_60);
StorageDead(_59);
StorageLive(_64);
StorageLive(_65);
- StorageLive(_66);
- _66 = _1;
- _67 = const 0_i32 as u32 (IntToInt);
- _68 = Lt(move _67, const 64_u32);
- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
+ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
}
bb30: {
- _65 = Shl(move _66, const 0_i32);
- StorageDead(_66);
+ _65 = Shl(_1, const 0_i32);
_64 = opaque::<u64>(move _65) -> [return: bb31, unwind unreachable];
}
bb31: {
StorageDead(_65);
StorageDead(_64);
_0 = const ();
return;
}

View File

@ -20,63 +20,12 @@
let mut _15: u64;
let mut _16: u64;
let mut _17: (u64, bool);
let _18: ();
let mut _19: u64;
let mut _20: u64;
let mut _21: bool;
let _22: ();
let mut _23: u64;
let mut _24: u64;
let mut _25: bool;
let _26: ();
let mut _27: u64;
let mut _28: u64;
let mut _29: bool;
let _30: ();
let mut _31: u64;
let mut _32: u64;
let mut _33: bool;
let _34: ();
let mut _35: u64;
let mut _36: u64;
let mut _37: bool;
let _38: ();
let mut _39: u64;
let mut _40: u64;
let mut _41: bool;
let _42: ();
let mut _43: u64;
let mut _44: u64;
let mut _45: bool;
let _46: ();
let mut _47: u64;
let mut _48: u64;
let mut _49: bool;
let _50: ();
let mut _51: u64;
let mut _52: u64;
let _53: ();
let mut _54: u64;
let mut _55: u64;
let _56: ();
let mut _57: u64;
let mut _58: u64;
let _59: ();
let mut _60: u64;
let mut _61: u64;
let mut _62: u32;
let mut _63: bool;
let _64: ();
let mut _65: u64;
let mut _66: u64;
let mut _67: u32;
let mut _68: bool;
bb0: {
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _5 = CheckedAdd(_4, const 0_u64);
- assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue];
+ _5 = CheckedAdd(_1, const 0_u64);
@ -85,7 +34,7 @@
bb1: {
_3 = move (_5.0: u64);
- StorageDead(_4);
StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
}
@ -94,8 +43,8 @@
StorageDead(_2);
StorageLive(_6);
StorageLive(_7);
- StorageLive(_8);
- _8 = _1;
StorageLive(_8);
_8 = _1;
- _9 = CheckedSub(_8, const 0_u64);
- assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue];
+ _9 = CheckedSub(_1, const 0_u64);
@ -104,7 +53,7 @@
bb3: {
_7 = move (_9.0: u64);
- StorageDead(_8);
StorageDead(_8);
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
}
@ -113,8 +62,8 @@
StorageDead(_6);
StorageLive(_10);
StorageLive(_11);
- StorageLive(_12);
- _12 = _1;
StorageLive(_12);
_12 = _1;
- _13 = CheckedMul(_12, const 0_u64);
- assert(!move (_13.1: bool), "attempt to compute `{} * {}`, which would overflow", move _12, const 0_u64) -> [success: bb5, unwind continue];
+ _13 = CheckedMul(_1, const 0_u64);
@ -123,7 +72,7 @@
bb5: {
_11 = move (_13.0: u64);
- StorageDead(_12);
StorageDead(_12);
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
}
@ -132,8 +81,8 @@
StorageDead(_10);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_16);
- _16 = _1;
StorageLive(_16);
_16 = _1;
- _17 = CheckedMul(_16, const 1_u64);
- assert(!move (_17.1: bool), "attempt to compute `{} * {}`, which would overflow", move _16, const 1_u64) -> [success: bb7, unwind continue];
+ _17 = CheckedMul(_1, const 1_u64);
@ -142,246 +91,13 @@
bb7: {
_15 = move (_17.0: u64);
- StorageDead(_16);
StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind continue];
}
bb8: {
StorageDead(_15);
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
- StorageLive(_20);
- _20 = _1;
_21 = Eq(const 0_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind continue];
+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind continue];
}
bb9: {
- _19 = Div(move _20, const 0_u64);
- StorageDead(_20);
+ _19 = Div(_1, const 0_u64);
_18 = opaque::<u64>(move _19) -> [return: bb10, unwind continue];
}
bb10: {
StorageDead(_19);
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
- StorageLive(_24);
- _24 = _1;
_25 = Eq(const 1_u64, const 0_u64);
- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind continue];
+ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind continue];
}
bb11: {
- _23 = Div(move _24, const 1_u64);
- StorageDead(_24);
+ _23 = Div(_1, const 1_u64);
_22 = opaque::<u64>(move _23) -> [return: bb12, unwind continue];
}
bb12: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
- StorageLive(_28);
- _28 = _1;
- _29 = Eq(_28, const 0_u64);
- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
+ _29 = Eq(_1, const 0_u64);
+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
}
bb13: {
- _27 = Div(const 0_u64, move _28);
- StorageDead(_28);
+ _27 = Div(const 0_u64, _1);
_26 = opaque::<u64>(move _27) -> [return: bb14, unwind continue];
}
bb14: {
StorageDead(_27);
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
- StorageLive(_32);
- _32 = _1;
- _33 = Eq(_32, const 0_u64);
- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
}
bb15: {
- _31 = Div(const 1_u64, move _32);
- StorageDead(_32);
+ _31 = Div(const 1_u64, _1);
_30 = opaque::<u64>(move _31) -> [return: bb16, unwind continue];
}
bb16: {
StorageDead(_31);
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
- StorageLive(_36);
- _36 = _1;
- _37 = Eq(const 0_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind continue];
+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind continue];
}
bb17: {
- _35 = Rem(move _36, const 0_u64);
- StorageDead(_36);
+ _35 = Rem(_1, const 0_u64);
_34 = opaque::<u64>(move _35) -> [return: bb18, unwind continue];
}
bb18: {
StorageDead(_35);
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
- StorageLive(_40);
- _40 = _1;
- _41 = Eq(const 1_u64, const 0_u64);
- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind continue];
+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind continue];
}
bb19: {
- _39 = Rem(move _40, const 1_u64);
- StorageDead(_40);
+ _39 = Rem(_1, const 1_u64);
_38 = opaque::<u64>(move _39) -> [return: bb20, unwind continue];
}
bb20: {
StorageDead(_39);
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
- StorageLive(_44);
- _44 = _1;
- _45 = Eq(_44, const 0_u64);
- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
}
bb21: {
- _43 = Rem(const 0_u64, move _44);
- StorageDead(_44);
+ _43 = Rem(const 0_u64, _1);
_42 = opaque::<u64>(move _43) -> [return: bb22, unwind continue];
}
bb22: {
StorageDead(_43);
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
- StorageLive(_48);
- _48 = _1;
- _49 = Eq(_48, const 0_u64);
- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
}
bb23: {
- _47 = Rem(const 1_u64, move _48);
- StorageDead(_48);
+ _47 = Rem(const 1_u64, _1);
_46 = opaque::<u64>(move _47) -> [return: bb24, unwind continue];
}
bb24: {
StorageDead(_47);
StorageDead(_46);
StorageLive(_50);
StorageLive(_51);
- StorageLive(_52);
- _52 = _1;
- _51 = BitAnd(move _52, const 0_u64);
- StorageDead(_52);
+ _51 = BitAnd(_1, const 0_u64);
_50 = opaque::<u64>(move _51) -> [return: bb25, unwind continue];
}
bb25: {
StorageDead(_51);
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
- StorageLive(_55);
- _55 = _1;
- _54 = BitOr(move _55, const 0_u64);
- StorageDead(_55);
+ _54 = BitOr(_1, const 0_u64);
_53 = opaque::<u64>(move _54) -> [return: bb26, unwind continue];
}
bb26: {
StorageDead(_54);
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
- StorageLive(_58);
- _58 = _1;
- _57 = BitXor(move _58, const 0_u64);
- StorageDead(_58);
+ _57 = BitXor(_1, const 0_u64);
_56 = opaque::<u64>(move _57) -> [return: bb27, unwind continue];
}
bb27: {
StorageDead(_57);
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
- StorageLive(_61);
- _61 = _1;
_62 = const 0_i32 as u32 (IntToInt);
- _63 = Lt(move _62, const 64_u32);
- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
+ _63 = Lt(_62, const 64_u32);
+ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
}
bb28: {
- _60 = Shr(move _61, const 0_i32);
- StorageDead(_61);
+ _60 = Shr(_1, const 0_i32);
_59 = opaque::<u64>(move _60) -> [return: bb29, unwind continue];
}
bb29: {
StorageDead(_60);
StorageDead(_59);
StorageLive(_64);
StorageLive(_65);
- StorageLive(_66);
- _66 = _1;
- _67 = const 0_i32 as u32 (IntToInt);
- _68 = Lt(move _67, const 64_u32);
- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
+ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
}
bb30: {
- _65 = Shl(move _66, const 0_i32);
- StorageDead(_66);
+ _65 = Shl(_1, const 0_i32);
_64 = opaque::<u64>(move _65) -> [return: bb31, unwind continue];
}
bb31: {
StorageDead(_65);
StorageDead(_64);
_0 = const ();
return;
}

View File

@ -37,11 +37,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _3 = Add(move _4, const 0f64);
- StorageDead(_4);
+ _3 = Add(_1, const 0f64);
StorageDead(_4);
_2 = opaque::<f64>(move _3) -> [return: bb1, unwind unreachable];
}
@ -50,11 +50,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
- StorageLive(_7);
- _7 = _1;
StorageLive(_7);
_7 = _1;
- _6 = Sub(move _7, const 0f64);
- StorageDead(_7);
+ _6 = Sub(_1, const 0f64);
StorageDead(_7);
_5 = opaque::<f64>(move _6) -> [return: bb2, unwind unreachable];
}
@ -63,11 +63,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
- StorageLive(_10);
- _10 = _1;
StorageLive(_10);
_10 = _1;
- _9 = Mul(move _10, const 0f64);
- StorageDead(_10);
+ _9 = Mul(_1, const 0f64);
StorageDead(_10);
_8 = opaque::<f64>(move _9) -> [return: bb3, unwind unreachable];
}
@ -76,11 +76,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
- StorageLive(_13);
- _13 = _1;
StorageLive(_13);
_13 = _1;
- _12 = Div(move _13, const 0f64);
- StorageDead(_13);
+ _12 = Div(_1, const 0f64);
StorageDead(_13);
_11 = opaque::<f64>(move _12) -> [return: bb4, unwind unreachable];
}
@ -89,11 +89,11 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_16);
- _16 = _1;
StorageLive(_16);
_16 = _1;
- _15 = Div(const 0f64, move _16);
- StorageDead(_16);
+ _15 = Div(const 0f64, _1);
StorageDead(_16);
_14 = opaque::<f64>(move _15) -> [return: bb5, unwind unreachable];
}
@ -102,11 +102,11 @@
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
- StorageLive(_19);
- _19 = _1;
StorageLive(_19);
_19 = _1;
- _18 = Rem(move _19, const 0f64);
- StorageDead(_19);
+ _18 = Rem(_1, const 0f64);
StorageDead(_19);
_17 = opaque::<f64>(move _18) -> [return: bb6, unwind unreachable];
}
@ -115,11 +115,11 @@
StorageDead(_17);
StorageLive(_20);
StorageLive(_21);
- StorageLive(_22);
- _22 = _1;
StorageLive(_22);
_22 = _1;
- _21 = Rem(const 0f64, move _22);
- StorageDead(_22);
+ _21 = Rem(const 0f64, _1);
StorageDead(_22);
_20 = opaque::<f64>(move _21) -> [return: bb7, unwind unreachable];
}
@ -128,14 +128,14 @@
StorageDead(_20);
StorageLive(_23);
StorageLive(_24);
- StorageLive(_25);
- _25 = _1;
- StorageLive(_26);
- _26 = _1;
StorageLive(_25);
_25 = _1;
StorageLive(_26);
_26 = _1;
- _24 = Eq(move _25, move _26);
- StorageDead(_26);
- StorageDead(_25);
+ _24 = Eq(_1, _1);
StorageDead(_26);
StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb8, unwind unreachable];
}
@ -144,14 +144,14 @@
StorageDead(_23);
StorageLive(_27);
StorageLive(_28);
- StorageLive(_29);
- _29 = _1;
- StorageLive(_30);
- _30 = _1;
StorageLive(_29);
_29 = _1;
StorageLive(_30);
_30 = _1;
- _28 = Ne(move _29, move _30);
- StorageDead(_30);
- StorageDead(_29);
+ _28 = Ne(_1, _1);
StorageDead(_30);
StorageDead(_29);
_27 = opaque::<bool>(move _28) -> [return: bb9, unwind unreachable];
}

View File

@ -37,11 +37,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _3 = Add(move _4, const 0f64);
- StorageDead(_4);
+ _3 = Add(_1, const 0f64);
StorageDead(_4);
_2 = opaque::<f64>(move _3) -> [return: bb1, unwind continue];
}
@ -50,11 +50,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
- StorageLive(_7);
- _7 = _1;
StorageLive(_7);
_7 = _1;
- _6 = Sub(move _7, const 0f64);
- StorageDead(_7);
+ _6 = Sub(_1, const 0f64);
StorageDead(_7);
_5 = opaque::<f64>(move _6) -> [return: bb2, unwind continue];
}
@ -63,11 +63,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
- StorageLive(_10);
- _10 = _1;
StorageLive(_10);
_10 = _1;
- _9 = Mul(move _10, const 0f64);
- StorageDead(_10);
+ _9 = Mul(_1, const 0f64);
StorageDead(_10);
_8 = opaque::<f64>(move _9) -> [return: bb3, unwind continue];
}
@ -76,11 +76,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
- StorageLive(_13);
- _13 = _1;
StorageLive(_13);
_13 = _1;
- _12 = Div(move _13, const 0f64);
- StorageDead(_13);
+ _12 = Div(_1, const 0f64);
StorageDead(_13);
_11 = opaque::<f64>(move _12) -> [return: bb4, unwind continue];
}
@ -89,11 +89,11 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
- StorageLive(_16);
- _16 = _1;
StorageLive(_16);
_16 = _1;
- _15 = Div(const 0f64, move _16);
- StorageDead(_16);
+ _15 = Div(const 0f64, _1);
StorageDead(_16);
_14 = opaque::<f64>(move _15) -> [return: bb5, unwind continue];
}
@ -102,11 +102,11 @@
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
- StorageLive(_19);
- _19 = _1;
StorageLive(_19);
_19 = _1;
- _18 = Rem(move _19, const 0f64);
- StorageDead(_19);
+ _18 = Rem(_1, const 0f64);
StorageDead(_19);
_17 = opaque::<f64>(move _18) -> [return: bb6, unwind continue];
}
@ -115,11 +115,11 @@
StorageDead(_17);
StorageLive(_20);
StorageLive(_21);
- StorageLive(_22);
- _22 = _1;
StorageLive(_22);
_22 = _1;
- _21 = Rem(const 0f64, move _22);
- StorageDead(_22);
+ _21 = Rem(const 0f64, _1);
StorageDead(_22);
_20 = opaque::<f64>(move _21) -> [return: bb7, unwind continue];
}
@ -128,14 +128,14 @@
StorageDead(_20);
StorageLive(_23);
StorageLive(_24);
- StorageLive(_25);
- _25 = _1;
- StorageLive(_26);
- _26 = _1;
StorageLive(_25);
_25 = _1;
StorageLive(_26);
_26 = _1;
- _24 = Eq(move _25, move _26);
- StorageDead(_26);
- StorageDead(_25);
+ _24 = Eq(_1, _1);
StorageDead(_26);
StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb8, unwind continue];
}
@ -144,14 +144,14 @@
StorageDead(_23);
StorageLive(_27);
StorageLive(_28);
- StorageLive(_29);
- _29 = _1;
- StorageLive(_30);
- _30 = _1;
StorageLive(_29);
_29 = _1;
StorageLive(_30);
_30 = _1;
- _28 = Ne(move _29, move _30);
- StorageDead(_30);
- StorageDead(_29);
+ _28 = Ne(_1, _1);
StorageDead(_30);
StorageDead(_29);
_27 = opaque::<bool>(move _28) -> [return: bb9, unwind continue];
}

View File

@ -105,19 +105,24 @@
bb0: {
- StorageLive(_1);
+ nop;
_1 = const 1_i64;
- StorageLive(_2);
+ nop;
_2 = const 1_u64;
- StorageLive(_3);
+ nop;
_3 = const 1f64;
StorageLive(_4);
StorageLive(_5);
- StorageLive(_6);
StorageLive(_6);
- _6 = _1;
- _5 = move _6 as u8 (IntToInt);
- StorageDead(_6);
+ _5 = const 1_i64 as u8 (IntToInt);
_4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
+ _6 = const 1_i64;
+ _5 = const 1_u8;
StorageDead(_6);
- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
+ _4 = opaque::<u8>(const 1_u8) -> [return: bb1, unwind unreachable];
}
bb1: {
@ -125,12 +130,14 @@
StorageDead(_4);
StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
StorageLive(_9);
- _9 = _1;
- _8 = move _9 as u16 (IntToInt);
- StorageDead(_9);
+ _8 = const 1_i64 as u16 (IntToInt);
_7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
+ _9 = const 1_i64;
+ _8 = const 1_u16;
StorageDead(_9);
- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
+ _7 = opaque::<u16>(const 1_u16) -> [return: bb2, unwind unreachable];
}
bb2: {
@ -138,12 +145,14 @@
StorageDead(_7);
StorageLive(_10);
StorageLive(_11);
- StorageLive(_12);
StorageLive(_12);
- _12 = _1;
- _11 = move _12 as u32 (IntToInt);
- StorageDead(_12);
+ _11 = const 1_i64 as u32 (IntToInt);
_10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
+ _12 = const 1_i64;
+ _11 = const 1_u32;
StorageDead(_12);
- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
+ _10 = opaque::<u32>(const 1_u32) -> [return: bb3, unwind unreachable];
}
bb3: {
@ -151,12 +160,14 @@
StorageDead(_10);
StorageLive(_13);
StorageLive(_14);
- StorageLive(_15);
StorageLive(_15);
- _15 = _1;
- _14 = move _15 as u64 (IntToInt);
- StorageDead(_15);
+ _14 = const 1_i64 as u64 (IntToInt);
_13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
+ _15 = const 1_i64;
+ _14 = const 1_u64;
StorageDead(_15);
- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
+ _13 = opaque::<u64>(const 1_u64) -> [return: bb4, unwind unreachable];
}
bb4: {
@ -164,12 +175,14 @@
StorageDead(_13);
StorageLive(_16);
StorageLive(_17);
- StorageLive(_18);
StorageLive(_18);
- _18 = _1;
- _17 = move _18 as i8 (IntToInt);
- StorageDead(_18);
+ _17 = const 1_i64 as i8 (IntToInt);
_16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
+ _18 = const 1_i64;
+ _17 = const 1_i8;
StorageDead(_18);
- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
+ _16 = opaque::<i8>(const 1_i8) -> [return: bb5, unwind unreachable];
}
bb5: {
@ -177,12 +190,14 @@
StorageDead(_16);
StorageLive(_19);
StorageLive(_20);
- StorageLive(_21);
StorageLive(_21);
- _21 = _1;
- _20 = move _21 as i16 (IntToInt);
- StorageDead(_21);
+ _20 = const 1_i64 as i16 (IntToInt);
_19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
+ _21 = const 1_i64;
+ _20 = const 1_i16;
StorageDead(_21);
- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
+ _19 = opaque::<i16>(const 1_i16) -> [return: bb6, unwind unreachable];
}
bb6: {
@ -190,35 +205,40 @@
StorageDead(_19);
StorageLive(_22);
StorageLive(_23);
- StorageLive(_24);
StorageLive(_24);
- _24 = _1;
- _23 = move _24 as i32 (IntToInt);
- StorageDead(_24);
+ _23 = const 1_i64 as i32 (IntToInt);
_22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
+ _24 = const 1_i64;
+ _23 = const 1_i32;
StorageDead(_24);
- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
+ _22 = opaque::<i32>(const 1_i32) -> [return: bb7, unwind unreachable];
}
bb7: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_25);
- StorageLive(_26);
StorageLive(_26);
- _26 = _1;
- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind unreachable];
+ _26 = const 1_i64;
+ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind unreachable];
}
bb8: {
- StorageDead(_26);
StorageDead(_26);
StorageDead(_25);
StorageLive(_27);
StorageLive(_28);
- StorageLive(_29);
StorageLive(_29);
- _29 = _1;
- _28 = move _29 as f32 (IntToFloat);
- StorageDead(_29);
+ _28 = const 1_i64 as f32 (IntToFloat);
_27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
+ _29 = const 1_i64;
+ _28 = const 1f32;
StorageDead(_29);
- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
+ _27 = opaque::<f32>(const 1f32) -> [return: bb9, unwind unreachable];
}
bb9: {
@ -226,12 +246,14 @@
StorageDead(_27);
StorageLive(_30);
StorageLive(_31);
- StorageLive(_32);
StorageLive(_32);
- _32 = _1;
- _31 = move _32 as f64 (IntToFloat);
- StorageDead(_32);
+ _31 = const 1_i64 as f64 (IntToFloat);
_30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
+ _32 = const 1_i64;
+ _31 = const 1f64;
StorageDead(_32);
- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
+ _30 = opaque::<f64>(const 1f64) -> [return: bb10, unwind unreachable];
}
bb10: {
@ -239,12 +261,14 @@
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
StorageLive(_35);
- _35 = _2;
- _34 = move _35 as u8 (IntToInt);
- StorageDead(_35);
+ _34 = const 1_u64 as u8 (IntToInt);
_33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
+ _35 = const 1_u64;
+ _34 = const 1_u8;
StorageDead(_35);
- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
+ _33 = opaque::<u8>(const 1_u8) -> [return: bb11, unwind unreachable];
}
bb11: {
@ -252,12 +276,14 @@
StorageDead(_33);
StorageLive(_36);
StorageLive(_37);
- StorageLive(_38);
StorageLive(_38);
- _38 = _2;
- _37 = move _38 as u16 (IntToInt);
- StorageDead(_38);
+ _37 = const 1_u64 as u16 (IntToInt);
_36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
+ _38 = const 1_u64;
+ _37 = const 1_u16;
StorageDead(_38);
- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
+ _36 = opaque::<u16>(const 1_u16) -> [return: bb12, unwind unreachable];
}
bb12: {
@ -265,35 +291,40 @@
StorageDead(_36);
StorageLive(_39);
StorageLive(_40);
- StorageLive(_41);
StorageLive(_41);
- _41 = _2;
- _40 = move _41 as u32 (IntToInt);
- StorageDead(_41);
+ _40 = const 1_u64 as u32 (IntToInt);
_39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
+ _41 = const 1_u64;
+ _40 = const 1_u32;
StorageDead(_41);
- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
+ _39 = opaque::<u32>(const 1_u32) -> [return: bb13, unwind unreachable];
}
bb13: {
StorageDead(_40);
StorageDead(_39);
StorageLive(_42);
- StorageLive(_43);
StorageLive(_43);
- _43 = _2;
- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind unreachable];
+ _43 = const 1_u64;
+ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind unreachable];
}
bb14: {
- StorageDead(_43);
StorageDead(_43);
StorageDead(_42);
StorageLive(_44);
StorageLive(_45);
- StorageLive(_46);
StorageLive(_46);
- _46 = _2;
- _45 = move _46 as i8 (IntToInt);
- StorageDead(_46);
+ _45 = const 1_u64 as i8 (IntToInt);
_44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
+ _46 = const 1_u64;
+ _45 = const 1_i8;
StorageDead(_46);
- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
+ _44 = opaque::<i8>(const 1_i8) -> [return: bb15, unwind unreachable];
}
bb15: {
@ -301,12 +332,14 @@
StorageDead(_44);
StorageLive(_47);
StorageLive(_48);
- StorageLive(_49);
StorageLive(_49);
- _49 = _2;
- _48 = move _49 as i16 (IntToInt);
- StorageDead(_49);
+ _48 = const 1_u64 as i16 (IntToInt);
_47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
+ _49 = const 1_u64;
+ _48 = const 1_i16;
StorageDead(_49);
- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
+ _47 = opaque::<i16>(const 1_i16) -> [return: bb16, unwind unreachable];
}
bb16: {
@ -314,12 +347,14 @@
StorageDead(_47);
StorageLive(_50);
StorageLive(_51);
- StorageLive(_52);
StorageLive(_52);
- _52 = _2;
- _51 = move _52 as i32 (IntToInt);
- StorageDead(_52);
+ _51 = const 1_u64 as i32 (IntToInt);
_50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
+ _52 = const 1_u64;
+ _51 = const 1_i32;
StorageDead(_52);
- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
+ _50 = opaque::<i32>(const 1_i32) -> [return: bb17, unwind unreachable];
}
bb17: {
@ -327,12 +362,14 @@
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
- StorageLive(_55);
StorageLive(_55);
- _55 = _2;
- _54 = move _55 as i64 (IntToInt);
- StorageDead(_55);
+ _54 = const 1_u64 as i64 (IntToInt);
_53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
+ _55 = const 1_u64;
+ _54 = const 1_i64;
StorageDead(_55);
- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
+ _53 = opaque::<i64>(const 1_i64) -> [return: bb18, unwind unreachable];
}
bb18: {
@ -340,12 +377,14 @@
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
- StorageLive(_58);
StorageLive(_58);
- _58 = _2;
- _57 = move _58 as f32 (IntToFloat);
- StorageDead(_58);
+ _57 = const 1_u64 as f32 (IntToFloat);
_56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
+ _58 = const 1_u64;
+ _57 = const 1f32;
StorageDead(_58);
- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
+ _56 = opaque::<f32>(const 1f32) -> [return: bb19, unwind unreachable];
}
bb19: {
@ -353,12 +392,14 @@
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
- StorageLive(_61);
StorageLive(_61);
- _61 = _2;
- _60 = move _61 as f64 (IntToFloat);
- StorageDead(_61);
+ _60 = const 1_u64 as f64 (IntToFloat);
_59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
+ _61 = const 1_u64;
+ _60 = const 1f64;
StorageDead(_61);
- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
+ _59 = opaque::<f64>(const 1f64) -> [return: bb20, unwind unreachable];
}
bb20: {
@ -366,12 +407,14 @@
StorageDead(_59);
StorageLive(_62);
StorageLive(_63);
- StorageLive(_64);
StorageLive(_64);
- _64 = _3;
- _63 = move _64 as u8 (FloatToInt);
- StorageDead(_64);
+ _63 = const 1f64 as u8 (FloatToInt);
_62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
+ _64 = const 1f64;
+ _63 = const 1_u8;
StorageDead(_64);
- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
+ _62 = opaque::<u8>(const 1_u8) -> [return: bb21, unwind unreachable];
}
bb21: {
@ -379,12 +422,14 @@
StorageDead(_62);
StorageLive(_65);
StorageLive(_66);
- StorageLive(_67);
StorageLive(_67);
- _67 = _3;
- _66 = move _67 as u16 (FloatToInt);
- StorageDead(_67);
+ _66 = const 1f64 as u16 (FloatToInt);
_65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
+ _67 = const 1f64;
+ _66 = const 1_u16;
StorageDead(_67);
- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
+ _65 = opaque::<u16>(const 1_u16) -> [return: bb22, unwind unreachable];
}
bb22: {
@ -392,12 +437,14 @@
StorageDead(_65);
StorageLive(_68);
StorageLive(_69);
- StorageLive(_70);
StorageLive(_70);
- _70 = _3;
- _69 = move _70 as u32 (FloatToInt);
- StorageDead(_70);
+ _69 = const 1f64 as u32 (FloatToInt);
_68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
+ _70 = const 1f64;
+ _69 = const 1_u32;
StorageDead(_70);
- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
+ _68 = opaque::<u32>(const 1_u32) -> [return: bb23, unwind unreachable];
}
bb23: {
@ -405,12 +452,14 @@
StorageDead(_68);
StorageLive(_71);
StorageLive(_72);
- StorageLive(_73);
StorageLive(_73);
- _73 = _3;
- _72 = move _73 as u64 (FloatToInt);
- StorageDead(_73);
+ _72 = const 1f64 as u64 (FloatToInt);
_71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
+ _73 = const 1f64;
+ _72 = const 1_u64;
StorageDead(_73);
- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
+ _71 = opaque::<u64>(const 1_u64) -> [return: bb24, unwind unreachable];
}
bb24: {
@ -418,12 +467,14 @@
StorageDead(_71);
StorageLive(_74);
StorageLive(_75);
- StorageLive(_76);
StorageLive(_76);
- _76 = _3;
- _75 = move _76 as i8 (FloatToInt);
- StorageDead(_76);
+ _75 = const 1f64 as i8 (FloatToInt);
_74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
+ _76 = const 1f64;
+ _75 = const 1_i8;
StorageDead(_76);
- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
+ _74 = opaque::<i8>(const 1_i8) -> [return: bb25, unwind unreachable];
}
bb25: {
@ -431,12 +482,14 @@
StorageDead(_74);
StorageLive(_77);
StorageLive(_78);
- StorageLive(_79);
StorageLive(_79);
- _79 = _3;
- _78 = move _79 as i16 (FloatToInt);
- StorageDead(_79);
+ _78 = const 1f64 as i16 (FloatToInt);
_77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
+ _79 = const 1f64;
+ _78 = const 1_i16;
StorageDead(_79);
- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
+ _77 = opaque::<i16>(const 1_i16) -> [return: bb26, unwind unreachable];
}
bb26: {
@ -444,12 +497,14 @@
StorageDead(_77);
StorageLive(_80);
StorageLive(_81);
- StorageLive(_82);
StorageLive(_82);
- _82 = _3;
- _81 = move _82 as i32 (FloatToInt);
- StorageDead(_82);
+ _81 = const 1f64 as i32 (FloatToInt);
_80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
+ _82 = const 1f64;
+ _81 = const 1_i32;
StorageDead(_82);
- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
+ _80 = opaque::<i32>(const 1_i32) -> [return: bb27, unwind unreachable];
}
bb27: {
@ -457,12 +512,14 @@
StorageDead(_80);
StorageLive(_83);
StorageLive(_84);
- StorageLive(_85);
StorageLive(_85);
- _85 = _3;
- _84 = move _85 as i64 (FloatToInt);
- StorageDead(_85);
+ _84 = const 1f64 as i64 (FloatToInt);
_83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
+ _85 = const 1f64;
+ _84 = const 1_i64;
StorageDead(_85);
- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
+ _83 = opaque::<i64>(const 1_i64) -> [return: bb28, unwind unreachable];
}
bb28: {
@ -470,31 +527,37 @@
StorageDead(_83);
StorageLive(_86);
StorageLive(_87);
- StorageLive(_88);
StorageLive(_88);
- _88 = _3;
- _87 = move _88 as f32 (FloatToFloat);
- StorageDead(_88);
+ _87 = const 1f64 as f32 (FloatToFloat);
_86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
+ _88 = const 1f64;
+ _87 = const 1f32;
StorageDead(_88);
- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
+ _86 = opaque::<f32>(const 1f32) -> [return: bb29, unwind unreachable];
}
bb29: {
StorageDead(_87);
StorageDead(_86);
StorageLive(_89);
- StorageLive(_90);
StorageLive(_90);
- _90 = _3;
- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind unreachable];
+ _90 = const 1f64;
+ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind unreachable];
}
bb30: {
- StorageDead(_90);
StorageDead(_90);
StorageDead(_89);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
return;
}
}

View File

@ -105,19 +105,24 @@
bb0: {
- StorageLive(_1);
+ nop;
_1 = const 1_i64;
- StorageLive(_2);
+ nop;
_2 = const 1_u64;
- StorageLive(_3);
+ nop;
_3 = const 1f64;
StorageLive(_4);
StorageLive(_5);
- StorageLive(_6);
StorageLive(_6);
- _6 = _1;
- _5 = move _6 as u8 (IntToInt);
- StorageDead(_6);
+ _5 = const 1_i64 as u8 (IntToInt);
_4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
+ _6 = const 1_i64;
+ _5 = const 1_u8;
StorageDead(_6);
- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
+ _4 = opaque::<u8>(const 1_u8) -> [return: bb1, unwind continue];
}
bb1: {
@ -125,12 +130,14 @@
StorageDead(_4);
StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
StorageLive(_9);
- _9 = _1;
- _8 = move _9 as u16 (IntToInt);
- StorageDead(_9);
+ _8 = const 1_i64 as u16 (IntToInt);
_7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
+ _9 = const 1_i64;
+ _8 = const 1_u16;
StorageDead(_9);
- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
+ _7 = opaque::<u16>(const 1_u16) -> [return: bb2, unwind continue];
}
bb2: {
@ -138,12 +145,14 @@
StorageDead(_7);
StorageLive(_10);
StorageLive(_11);
- StorageLive(_12);
StorageLive(_12);
- _12 = _1;
- _11 = move _12 as u32 (IntToInt);
- StorageDead(_12);
+ _11 = const 1_i64 as u32 (IntToInt);
_10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
+ _12 = const 1_i64;
+ _11 = const 1_u32;
StorageDead(_12);
- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
+ _10 = opaque::<u32>(const 1_u32) -> [return: bb3, unwind continue];
}
bb3: {
@ -151,12 +160,14 @@
StorageDead(_10);
StorageLive(_13);
StorageLive(_14);
- StorageLive(_15);
StorageLive(_15);
- _15 = _1;
- _14 = move _15 as u64 (IntToInt);
- StorageDead(_15);
+ _14 = const 1_i64 as u64 (IntToInt);
_13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
+ _15 = const 1_i64;
+ _14 = const 1_u64;
StorageDead(_15);
- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
+ _13 = opaque::<u64>(const 1_u64) -> [return: bb4, unwind continue];
}
bb4: {
@ -164,12 +175,14 @@
StorageDead(_13);
StorageLive(_16);
StorageLive(_17);
- StorageLive(_18);
StorageLive(_18);
- _18 = _1;
- _17 = move _18 as i8 (IntToInt);
- StorageDead(_18);
+ _17 = const 1_i64 as i8 (IntToInt);
_16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
+ _18 = const 1_i64;
+ _17 = const 1_i8;
StorageDead(_18);
- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
+ _16 = opaque::<i8>(const 1_i8) -> [return: bb5, unwind continue];
}
bb5: {
@ -177,12 +190,14 @@
StorageDead(_16);
StorageLive(_19);
StorageLive(_20);
- StorageLive(_21);
StorageLive(_21);
- _21 = _1;
- _20 = move _21 as i16 (IntToInt);
- StorageDead(_21);
+ _20 = const 1_i64 as i16 (IntToInt);
_19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
+ _21 = const 1_i64;
+ _20 = const 1_i16;
StorageDead(_21);
- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
+ _19 = opaque::<i16>(const 1_i16) -> [return: bb6, unwind continue];
}
bb6: {
@ -190,35 +205,40 @@
StorageDead(_19);
StorageLive(_22);
StorageLive(_23);
- StorageLive(_24);
StorageLive(_24);
- _24 = _1;
- _23 = move _24 as i32 (IntToInt);
- StorageDead(_24);
+ _23 = const 1_i64 as i32 (IntToInt);
_22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
+ _24 = const 1_i64;
+ _23 = const 1_i32;
StorageDead(_24);
- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
+ _22 = opaque::<i32>(const 1_i32) -> [return: bb7, unwind continue];
}
bb7: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_25);
- StorageLive(_26);
StorageLive(_26);
- _26 = _1;
- _25 = opaque::<i64>(move _26) -> [return: bb8, unwind continue];
+ _26 = const 1_i64;
+ _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_26);
StorageDead(_26);
StorageDead(_25);
StorageLive(_27);
StorageLive(_28);
- StorageLive(_29);
StorageLive(_29);
- _29 = _1;
- _28 = move _29 as f32 (IntToFloat);
- StorageDead(_29);
+ _28 = const 1_i64 as f32 (IntToFloat);
_27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
+ _29 = const 1_i64;
+ _28 = const 1f32;
StorageDead(_29);
- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
+ _27 = opaque::<f32>(const 1f32) -> [return: bb9, unwind continue];
}
bb9: {
@ -226,12 +246,14 @@
StorageDead(_27);
StorageLive(_30);
StorageLive(_31);
- StorageLive(_32);
StorageLive(_32);
- _32 = _1;
- _31 = move _32 as f64 (IntToFloat);
- StorageDead(_32);
+ _31 = const 1_i64 as f64 (IntToFloat);
_30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
+ _32 = const 1_i64;
+ _31 = const 1f64;
StorageDead(_32);
- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
+ _30 = opaque::<f64>(const 1f64) -> [return: bb10, unwind continue];
}
bb10: {
@ -239,12 +261,14 @@
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
StorageLive(_35);
- _35 = _2;
- _34 = move _35 as u8 (IntToInt);
- StorageDead(_35);
+ _34 = const 1_u64 as u8 (IntToInt);
_33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
+ _35 = const 1_u64;
+ _34 = const 1_u8;
StorageDead(_35);
- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
+ _33 = opaque::<u8>(const 1_u8) -> [return: bb11, unwind continue];
}
bb11: {
@ -252,12 +276,14 @@
StorageDead(_33);
StorageLive(_36);
StorageLive(_37);
- StorageLive(_38);
StorageLive(_38);
- _38 = _2;
- _37 = move _38 as u16 (IntToInt);
- StorageDead(_38);
+ _37 = const 1_u64 as u16 (IntToInt);
_36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
+ _38 = const 1_u64;
+ _37 = const 1_u16;
StorageDead(_38);
- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
+ _36 = opaque::<u16>(const 1_u16) -> [return: bb12, unwind continue];
}
bb12: {
@ -265,35 +291,40 @@
StorageDead(_36);
StorageLive(_39);
StorageLive(_40);
- StorageLive(_41);
StorageLive(_41);
- _41 = _2;
- _40 = move _41 as u32 (IntToInt);
- StorageDead(_41);
+ _40 = const 1_u64 as u32 (IntToInt);
_39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
+ _41 = const 1_u64;
+ _40 = const 1_u32;
StorageDead(_41);
- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
+ _39 = opaque::<u32>(const 1_u32) -> [return: bb13, unwind continue];
}
bb13: {
StorageDead(_40);
StorageDead(_39);
StorageLive(_42);
- StorageLive(_43);
StorageLive(_43);
- _43 = _2;
- _42 = opaque::<u64>(move _43) -> [return: bb14, unwind continue];
+ _43 = const 1_u64;
+ _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind continue];
}
bb14: {
- StorageDead(_43);
StorageDead(_43);
StorageDead(_42);
StorageLive(_44);
StorageLive(_45);
- StorageLive(_46);
StorageLive(_46);
- _46 = _2;
- _45 = move _46 as i8 (IntToInt);
- StorageDead(_46);
+ _45 = const 1_u64 as i8 (IntToInt);
_44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
+ _46 = const 1_u64;
+ _45 = const 1_i8;
StorageDead(_46);
- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
+ _44 = opaque::<i8>(const 1_i8) -> [return: bb15, unwind continue];
}
bb15: {
@ -301,12 +332,14 @@
StorageDead(_44);
StorageLive(_47);
StorageLive(_48);
- StorageLive(_49);
StorageLive(_49);
- _49 = _2;
- _48 = move _49 as i16 (IntToInt);
- StorageDead(_49);
+ _48 = const 1_u64 as i16 (IntToInt);
_47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
+ _49 = const 1_u64;
+ _48 = const 1_i16;
StorageDead(_49);
- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
+ _47 = opaque::<i16>(const 1_i16) -> [return: bb16, unwind continue];
}
bb16: {
@ -314,12 +347,14 @@
StorageDead(_47);
StorageLive(_50);
StorageLive(_51);
- StorageLive(_52);
StorageLive(_52);
- _52 = _2;
- _51 = move _52 as i32 (IntToInt);
- StorageDead(_52);
+ _51 = const 1_u64 as i32 (IntToInt);
_50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
+ _52 = const 1_u64;
+ _51 = const 1_i32;
StorageDead(_52);
- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
+ _50 = opaque::<i32>(const 1_i32) -> [return: bb17, unwind continue];
}
bb17: {
@ -327,12 +362,14 @@
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
- StorageLive(_55);
StorageLive(_55);
- _55 = _2;
- _54 = move _55 as i64 (IntToInt);
- StorageDead(_55);
+ _54 = const 1_u64 as i64 (IntToInt);
_53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
+ _55 = const 1_u64;
+ _54 = const 1_i64;
StorageDead(_55);
- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
+ _53 = opaque::<i64>(const 1_i64) -> [return: bb18, unwind continue];
}
bb18: {
@ -340,12 +377,14 @@
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
- StorageLive(_58);
StorageLive(_58);
- _58 = _2;
- _57 = move _58 as f32 (IntToFloat);
- StorageDead(_58);
+ _57 = const 1_u64 as f32 (IntToFloat);
_56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
+ _58 = const 1_u64;
+ _57 = const 1f32;
StorageDead(_58);
- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
+ _56 = opaque::<f32>(const 1f32) -> [return: bb19, unwind continue];
}
bb19: {
@ -353,12 +392,14 @@
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
- StorageLive(_61);
StorageLive(_61);
- _61 = _2;
- _60 = move _61 as f64 (IntToFloat);
- StorageDead(_61);
+ _60 = const 1_u64 as f64 (IntToFloat);
_59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
+ _61 = const 1_u64;
+ _60 = const 1f64;
StorageDead(_61);
- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
+ _59 = opaque::<f64>(const 1f64) -> [return: bb20, unwind continue];
}
bb20: {
@ -366,12 +407,14 @@
StorageDead(_59);
StorageLive(_62);
StorageLive(_63);
- StorageLive(_64);
StorageLive(_64);
- _64 = _3;
- _63 = move _64 as u8 (FloatToInt);
- StorageDead(_64);
+ _63 = const 1f64 as u8 (FloatToInt);
_62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
+ _64 = const 1f64;
+ _63 = const 1_u8;
StorageDead(_64);
- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
+ _62 = opaque::<u8>(const 1_u8) -> [return: bb21, unwind continue];
}
bb21: {
@ -379,12 +422,14 @@
StorageDead(_62);
StorageLive(_65);
StorageLive(_66);
- StorageLive(_67);
StorageLive(_67);
- _67 = _3;
- _66 = move _67 as u16 (FloatToInt);
- StorageDead(_67);
+ _66 = const 1f64 as u16 (FloatToInt);
_65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
+ _67 = const 1f64;
+ _66 = const 1_u16;
StorageDead(_67);
- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
+ _65 = opaque::<u16>(const 1_u16) -> [return: bb22, unwind continue];
}
bb22: {
@ -392,12 +437,14 @@
StorageDead(_65);
StorageLive(_68);
StorageLive(_69);
- StorageLive(_70);
StorageLive(_70);
- _70 = _3;
- _69 = move _70 as u32 (FloatToInt);
- StorageDead(_70);
+ _69 = const 1f64 as u32 (FloatToInt);
_68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
+ _70 = const 1f64;
+ _69 = const 1_u32;
StorageDead(_70);
- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
+ _68 = opaque::<u32>(const 1_u32) -> [return: bb23, unwind continue];
}
bb23: {
@ -405,12 +452,14 @@
StorageDead(_68);
StorageLive(_71);
StorageLive(_72);
- StorageLive(_73);
StorageLive(_73);
- _73 = _3;
- _72 = move _73 as u64 (FloatToInt);
- StorageDead(_73);
+ _72 = const 1f64 as u64 (FloatToInt);
_71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
+ _73 = const 1f64;
+ _72 = const 1_u64;
StorageDead(_73);
- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
+ _71 = opaque::<u64>(const 1_u64) -> [return: bb24, unwind continue];
}
bb24: {
@ -418,12 +467,14 @@
StorageDead(_71);
StorageLive(_74);
StorageLive(_75);
- StorageLive(_76);
StorageLive(_76);
- _76 = _3;
- _75 = move _76 as i8 (FloatToInt);
- StorageDead(_76);
+ _75 = const 1f64 as i8 (FloatToInt);
_74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
+ _76 = const 1f64;
+ _75 = const 1_i8;
StorageDead(_76);
- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
+ _74 = opaque::<i8>(const 1_i8) -> [return: bb25, unwind continue];
}
bb25: {
@ -431,12 +482,14 @@
StorageDead(_74);
StorageLive(_77);
StorageLive(_78);
- StorageLive(_79);
StorageLive(_79);
- _79 = _3;
- _78 = move _79 as i16 (FloatToInt);
- StorageDead(_79);
+ _78 = const 1f64 as i16 (FloatToInt);
_77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
+ _79 = const 1f64;
+ _78 = const 1_i16;
StorageDead(_79);
- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
+ _77 = opaque::<i16>(const 1_i16) -> [return: bb26, unwind continue];
}
bb26: {
@ -444,12 +497,14 @@
StorageDead(_77);
StorageLive(_80);
StorageLive(_81);
- StorageLive(_82);
StorageLive(_82);
- _82 = _3;
- _81 = move _82 as i32 (FloatToInt);
- StorageDead(_82);
+ _81 = const 1f64 as i32 (FloatToInt);
_80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
+ _82 = const 1f64;
+ _81 = const 1_i32;
StorageDead(_82);
- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
+ _80 = opaque::<i32>(const 1_i32) -> [return: bb27, unwind continue];
}
bb27: {
@ -457,12 +512,14 @@
StorageDead(_80);
StorageLive(_83);
StorageLive(_84);
- StorageLive(_85);
StorageLive(_85);
- _85 = _3;
- _84 = move _85 as i64 (FloatToInt);
- StorageDead(_85);
+ _84 = const 1f64 as i64 (FloatToInt);
_83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
+ _85 = const 1f64;
+ _84 = const 1_i64;
StorageDead(_85);
- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
+ _83 = opaque::<i64>(const 1_i64) -> [return: bb28, unwind continue];
}
bb28: {
@ -470,31 +527,37 @@
StorageDead(_83);
StorageLive(_86);
StorageLive(_87);
- StorageLive(_88);
StorageLive(_88);
- _88 = _3;
- _87 = move _88 as f32 (FloatToFloat);
- StorageDead(_88);
+ _87 = const 1f64 as f32 (FloatToFloat);
_86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
+ _88 = const 1f64;
+ _87 = const 1f32;
StorageDead(_88);
- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
+ _86 = opaque::<f32>(const 1f32) -> [return: bb29, unwind continue];
}
bb29: {
StorageDead(_87);
StorageDead(_86);
StorageLive(_89);
- StorageLive(_90);
StorageLive(_90);
- _90 = _3;
- _89 = opaque::<f64>(move _90) -> [return: bb30, unwind continue];
+ _90 = const 1f64;
+ _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind continue];
}
bb30: {
- StorageDead(_90);
StorageDead(_90);
StorageDead(_89);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
return;
}
}

View File

@ -0,0 +1,94 @@
- // MIR for `comparison` before GVN
+ // MIR for `comparison` after GVN
fn comparison(_1: u64, _2: u64) -> () {
debug x => _1;
debug y => _2;
let mut _0: ();
let _3: ();
let mut _4: bool;
let mut _5: u64;
let mut _6: u64;
let _7: ();
let mut _8: bool;
let mut _9: u64;
let mut _10: u64;
let _11: ();
let mut _12: bool;
let mut _13: u64;
let mut _14: u64;
let _15: ();
let mut _16: bool;
let mut _17: u64;
let mut _18: u64;
bb0: {
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
StorageLive(_6);
_6 = _1;
- _4 = Eq(move _5, move _6);
+ _4 = Eq(_1, _1);
StorageDead(_6);
StorageDead(_5);
_3 = opaque::<bool>(move _4) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_4);
StorageDead(_3);
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
_9 = _1;
StorageLive(_10);
_10 = _1;
- _8 = Ne(move _9, move _10);
+ _8 = Ne(_1, _1);
StorageDead(_10);
StorageDead(_9);
_7 = opaque::<bool>(move _8) -> [return: bb2, unwind unreachable];
}
bb2: {
StorageDead(_8);
StorageDead(_7);
StorageLive(_11);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
StorageLive(_14);
_14 = _2;
- _12 = Eq(move _13, move _14);
+ _12 = Eq(_1, _2);
StorageDead(_14);
StorageDead(_13);
_11 = opaque::<bool>(move _12) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_12);
StorageDead(_11);
StorageLive(_15);
StorageLive(_16);
StorageLive(_17);
_17 = _1;
StorageLive(_18);
_18 = _2;
- _16 = Ne(move _17, move _18);
+ _16 = Ne(_1, _2);
StorageDead(_18);
StorageDead(_17);
_15 = opaque::<bool>(move _16) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_16);
StorageDead(_15);
_0 = const ();
return;
}
}

View File

@ -0,0 +1,94 @@
- // MIR for `comparison` before GVN
+ // MIR for `comparison` after GVN
fn comparison(_1: u64, _2: u64) -> () {
debug x => _1;
debug y => _2;
let mut _0: ();
let _3: ();
let mut _4: bool;
let mut _5: u64;
let mut _6: u64;
let _7: ();
let mut _8: bool;
let mut _9: u64;
let mut _10: u64;
let _11: ();
let mut _12: bool;
let mut _13: u64;
let mut _14: u64;
let _15: ();
let mut _16: bool;
let mut _17: u64;
let mut _18: u64;
bb0: {
StorageLive(_3);
StorageLive(_4);
StorageLive(_5);
_5 = _1;
StorageLive(_6);
_6 = _1;
- _4 = Eq(move _5, move _6);
+ _4 = Eq(_1, _1);
StorageDead(_6);
StorageDead(_5);
_3 = opaque::<bool>(move _4) -> [return: bb1, unwind continue];
}
bb1: {
StorageDead(_4);
StorageDead(_3);
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
_9 = _1;
StorageLive(_10);
_10 = _1;
- _8 = Ne(move _9, move _10);
+ _8 = Ne(_1, _1);
StorageDead(_10);
StorageDead(_9);
_7 = opaque::<bool>(move _8) -> [return: bb2, unwind continue];
}
bb2: {
StorageDead(_8);
StorageDead(_7);
StorageLive(_11);
StorageLive(_12);
StorageLive(_13);
_13 = _1;
StorageLive(_14);
_14 = _2;
- _12 = Eq(move _13, move _14);
+ _12 = Eq(_1, _2);
StorageDead(_14);
StorageDead(_13);
_11 = opaque::<bool>(move _12) -> [return: bb3, unwind continue];
}
bb3: {
StorageDead(_12);
StorageDead(_11);
StorageLive(_15);
StorageLive(_16);
StorageLive(_17);
_17 = _1;
StorageLive(_18);
_18 = _2;
- _16 = Ne(move _17, move _18);
+ _16 = Ne(_1, _2);
StorageDead(_18);
StorageDead(_17);
_15 = opaque::<bool>(move _16) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_16);
StorageDead(_15);
_0 = const ();
return;
}
}

View File

@ -72,7 +72,8 @@
bb2: {
StorageDead(_7);
StorageDead(_6);
StorageLive(_8);
- StorageLive(_8);
+ nop;
_8 = &raw const (*_1);
StorageLive(_9);
StorageLive(_10);
@ -92,7 +93,8 @@
bb4: {
StorageDead(_12);
StorageDead(_11);
StorageLive(_13);
- StorageLive(_13);
+ nop;
_13 = &raw mut (*_1);
StorageLive(_14);
StorageLive(_15);
@ -112,10 +114,12 @@
bb6: {
StorageDead(_17);
StorageDead(_16);
StorageLive(_18);
- StorageLive(_18);
+ nop;
_18 = &(*_1);
StorageLive(_19);
- StorageLive(_20);
+ nop;
_20 = (*_18);
- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable];
+ _19 = opaque::<u32>(_20) -> [return: bb7, unwind unreachable];
@ -123,16 +127,18 @@
bb7: {
- StorageDead(_20);
+ nop;
StorageDead(_19);
StorageLive(_21);
- StorageLive(_22);
StorageLive(_22);
- _22 = (*_18);
- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable];
+ _22 = _20;
+ _21 = opaque::<u32>(_20) -> [return: bb8, unwind unreachable];
}
bb8: {
- StorageDead(_22);
StorageDead(_22);
StorageDead(_21);
StorageLive(_23);
StorageLive(_24);
@ -163,6 +169,7 @@
StorageDead(_27);
StorageLive(_29);
- StorageLive(_30);
+ nop;
_30 = ((*_3).0: u32);
- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable];
+ _29 = opaque::<u32>(_30) -> [return: bb12, unwind unreachable];
@ -170,21 +177,26 @@
bb12: {
- StorageDead(_30);
+ nop;
StorageDead(_29);
StorageLive(_31);
- StorageLive(_32);
StorageLive(_32);
- _32 = ((*_3).0: u32);
- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable];
+ _32 = _30;
+ _31 = opaque::<u32>(_30) -> [return: bb13, unwind unreachable];
}
bb13: {
- StorageDead(_32);
StorageDead(_32);
StorageDead(_31);
_0 = const ();
StorageDead(_18);
StorageDead(_13);
StorageDead(_8);
- StorageDead(_18);
- StorageDead(_13);
- StorageDead(_8);
+ nop;
+ nop;
+ nop;
return;
}
}

View File

@ -72,7 +72,8 @@
bb2: {
StorageDead(_7);
StorageDead(_6);
StorageLive(_8);
- StorageLive(_8);
+ nop;
_8 = &raw const (*_1);
StorageLive(_9);
StorageLive(_10);
@ -92,7 +93,8 @@
bb4: {
StorageDead(_12);
StorageDead(_11);
StorageLive(_13);
- StorageLive(_13);
+ nop;
_13 = &raw mut (*_1);
StorageLive(_14);
StorageLive(_15);
@ -112,10 +114,12 @@
bb6: {
StorageDead(_17);
StorageDead(_16);
StorageLive(_18);
- StorageLive(_18);
+ nop;
_18 = &(*_1);
StorageLive(_19);
- StorageLive(_20);
+ nop;
_20 = (*_18);
- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue];
+ _19 = opaque::<u32>(_20) -> [return: bb7, unwind continue];
@ -123,16 +127,18 @@
bb7: {
- StorageDead(_20);
+ nop;
StorageDead(_19);
StorageLive(_21);
- StorageLive(_22);
StorageLive(_22);
- _22 = (*_18);
- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue];
+ _22 = _20;
+ _21 = opaque::<u32>(_20) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_22);
StorageDead(_22);
StorageDead(_21);
StorageLive(_23);
StorageLive(_24);
@ -163,6 +169,7 @@
StorageDead(_27);
StorageLive(_29);
- StorageLive(_30);
+ nop;
_30 = ((*_3).0: u32);
- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue];
+ _29 = opaque::<u32>(_30) -> [return: bb12, unwind continue];
@ -170,21 +177,26 @@
bb12: {
- StorageDead(_30);
+ nop;
StorageDead(_29);
StorageLive(_31);
- StorageLive(_32);
StorageLive(_32);
- _32 = ((*_3).0: u32);
- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue];
+ _32 = _30;
+ _31 = opaque::<u32>(_30) -> [return: bb13, unwind continue];
}
bb13: {
- StorageDead(_32);
StorageDead(_32);
StorageDead(_31);
_0 = const ();
StorageDead(_18);
StorageDead(_13);
StorageDead(_8);
- StorageDead(_18);
- StorageDead(_13);
- StorageDead(_8);
+ nop;
+ nop;
+ nop;
return;
}
}

View File

@ -0,0 +1,38 @@
- // MIR for `duplicate_slice` before GVN
+ // MIR for `duplicate_slice` after GVN
fn duplicate_slice() -> (bool, bool) {
let mut _0: (bool, bool);
let mut _1: u128;
let mut _2: u128;
let mut _3: u128;
let mut _4: u128;
let mut _5: &str;
let mut _6: &str;
let mut _7: (&str,);
let mut _8: &str;
let mut _9: bool;
let mut _10: bool;
bb0: {
_7 = (const "a",);
_1 = (_7.0: &str) as u128 (Transmute);
_5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind unreachable];
}
bb1: {
_3 = _5 as u128 (Transmute);
_8 = const "a";
_2 = _8 as u128 (Transmute);
_6 = identity::<&str>(_8) -> [return: bb2, unwind unreachable];
}
bb2: {
_4 = _6 as u128 (Transmute);
_9 = Eq(_1, _2);
_10 = Eq(_3, _4);
_0 = (_9, _10);
return;
}
}

View File

@ -0,0 +1,38 @@
- // MIR for `duplicate_slice` before GVN
+ // MIR for `duplicate_slice` after GVN
fn duplicate_slice() -> (bool, bool) {
let mut _0: (bool, bool);
let mut _1: u128;
let mut _2: u128;
let mut _3: u128;
let mut _4: u128;
let mut _5: &str;
let mut _6: &str;
let mut _7: (&str,);
let mut _8: &str;
let mut _9: bool;
let mut _10: bool;
bb0: {
_7 = (const "a",);
_1 = (_7.0: &str) as u128 (Transmute);
_5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind continue];
}
bb1: {
_3 = _5 as u128 (Transmute);
_8 = const "a";
_2 = _8 as u128 (Transmute);
_6 = identity::<&str>(_8) -> [return: bb2, unwind continue];
}
bb2: {
_4 = _6 as u128 (Transmute);
_9 = Eq(_1, _2);
_10 = Eq(_3, _4);
_0 = (_9, _10);
return;
}
}

View File

@ -0,0 +1,118 @@
- // MIR for `fn_pointers` before GVN
+ // MIR for `fn_pointers` after GVN
fn fn_pointers() -> () {
let mut _0: ();
let _1: fn(u8) -> u8;
let _2: ();
let mut _3: fn(u8) -> u8;
let _5: ();
let mut _6: fn(u8) -> u8;
let mut _9: {closure@$DIR/gvn.rs:591:19: 591:21};
let _10: ();
let mut _11: fn();
let mut _13: {closure@$DIR/gvn.rs:591:19: 591:21};
let _14: ();
let mut _15: fn();
scope 1 {
debug f => _1;
let _4: fn(u8) -> u8;
scope 2 {
debug g => _4;
let _7: {closure@$DIR/gvn.rs:591:19: 591:21};
scope 3 {
debug closure => _7;
let _8: fn();
scope 4 {
debug cf => _8;
let _12: fn();
scope 5 {
debug cg => _12;
}
}
}
}
}
bb0: {
- StorageLive(_1);
+ nop;
_1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
StorageLive(_2);
StorageLive(_3);
_3 = _1;
- _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind unreachable];
+ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind unreachable];
}
bb1: {
StorageDead(_3);
StorageDead(_2);
- StorageLive(_4);
+ nop;
_4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
StorageLive(_5);
StorageLive(_6);
_6 = _4;
- _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind unreachable];
+ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind unreachable];
}
bb2: {
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:591:19: 591:21};
- StorageLive(_8);
+ nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
+ nop;
StorageLive(_9);
- _9 = _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_9);
StorageLive(_10);
StorageLive(_11);
_11 = _8;
- _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind unreachable];
+ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind unreachable];
}
bb3: {
StorageDead(_11);
StorageDead(_10);
- StorageLive(_12);
+ nop;
StorageLive(_13);
- _13 = _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_13);
StorageLive(_14);
StorageLive(_15);
_15 = _12;
- _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind unreachable];
+ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_15);
StorageDead(_14);
_0 = const ();
- StorageDead(_12);
- StorageDead(_8);
- StorageDead(_7);
- StorageDead(_4);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
+ nop;
+ nop;
return;
}
}

View File

@ -0,0 +1,118 @@
- // MIR for `fn_pointers` before GVN
+ // MIR for `fn_pointers` after GVN
fn fn_pointers() -> () {
let mut _0: ();
let _1: fn(u8) -> u8;
let _2: ();
let mut _3: fn(u8) -> u8;
let _5: ();
let mut _6: fn(u8) -> u8;
let mut _9: {closure@$DIR/gvn.rs:591:19: 591:21};
let _10: ();
let mut _11: fn();
let mut _13: {closure@$DIR/gvn.rs:591:19: 591:21};
let _14: ();
let mut _15: fn();
scope 1 {
debug f => _1;
let _4: fn(u8) -> u8;
scope 2 {
debug g => _4;
let _7: {closure@$DIR/gvn.rs:591:19: 591:21};
scope 3 {
debug closure => _7;
let _8: fn();
scope 4 {
debug cf => _8;
let _12: fn();
scope 5 {
debug cg => _12;
}
}
}
}
}
bb0: {
- StorageLive(_1);
+ nop;
_1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
StorageLive(_2);
StorageLive(_3);
_3 = _1;
- _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind continue];
+ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind continue];
}
bb1: {
StorageDead(_3);
StorageDead(_2);
- StorageLive(_4);
+ nop;
_4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer));
StorageLive(_5);
StorageLive(_6);
_6 = _4;
- _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind continue];
+ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind continue];
}
bb2: {
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:591:19: 591:21};
- StorageLive(_8);
+ nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
+ nop;
StorageLive(_9);
- _9 = _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_9);
StorageLive(_10);
StorageLive(_11);
_11 = _8;
- _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind continue];
+ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind continue];
}
bb3: {
StorageDead(_11);
StorageDead(_10);
- StorageLive(_12);
+ nop;
StorageLive(_13);
- _13 = _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Normal)));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:591:19: 591:21} as fn() (PointerCoercion(ClosureFnPointer(Normal)));
StorageDead(_13);
StorageLive(_14);
StorageLive(_15);
_15 = _12;
- _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind continue];
+ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_15);
StorageDead(_14);
_0 = const ();
- StorageDead(_12);
- StorageDead(_8);
- StorageDead(_7);
- StorageDead(_4);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
+ nop;
+ nop;
return;
}
}

View File

@ -0,0 +1,19 @@
- // MIR for `indirect_static` before GVN
+ // MIR for `indirect_static` after GVN
fn indirect_static() -> () {
let mut _0: ();
let mut _1: &std::option::Option<u8>;
let mut _2: u8;
bb0: {
_1 = const {ALLOC0: &Option<u8>};
_2 = (((*_1) as variant#1).0: u8);
return;
}
}
ALLOC0 (static: A, size: 2, align: 1) {
00 __ │ .░
}

View File

@ -0,0 +1,19 @@
- // MIR for `indirect_static` before GVN
+ // MIR for `indirect_static` after GVN
fn indirect_static() -> () {
let mut _0: ();
let mut _1: &std::option::Option<u8>;
let mut _2: u8;
bb0: {
_1 = const {ALLOC0: &Option<u8>};
_2 = (((*_1) as variant#1).0: u8);
return;
}
}
ALLOC0 (static: A, size: 2, align: 1) {
00 __ │ .░
}

View File

@ -39,9 +39,9 @@
let mut _34: u8;
bb0: {
- StorageLive(_4);
- StorageLive(_5);
- _5 = _1;
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- switchInt(move _5) -> [0: bb4, otherwise: bb1];
+ switchInt(_1) -> [0: bb4, otherwise: bb1];
}
@ -49,121 +49,130 @@
bb1: {
StorageLive(_6);
- StorageLive(_7);
- StorageLive(_8);
- _8 = _2;
- StorageLive(_9);
- _9 = _3;
+ nop;
StorageLive(_8);
_8 = _2;
StorageLive(_9);
_9 = _3;
- _7 = Add(move _8, move _9);
- StorageDead(_9);
- StorageDead(_8);
- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
+ _7 = Add(_2, _3);
StorageDead(_9);
StorageDead(_8);
- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
+ _6 = opaque::<u8>(_7) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_7);
+ nop;
StorageDead(_6);
StorageLive(_10);
- StorageLive(_11);
- StorageLive(_12);
- _12 = _2;
- StorageLive(_13);
- _13 = _3;
StorageLive(_11);
StorageLive(_12);
_12 = _2;
StorageLive(_13);
_13 = _3;
- _11 = Add(move _12, move _13);
- StorageDead(_13);
- StorageDead(_12);
+ _11 = _7;
StorageDead(_13);
StorageDead(_12);
- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind unreachable];
+ _10 = opaque::<u8>(_7) -> [return: bb3, unwind unreachable];
}
bb3: {
- StorageDead(_11);
StorageDead(_11);
StorageDead(_10);
- _4 = const ();
_4 = const ();
goto -> bb7;
}
bb4: {
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
- _16 = _2;
- StorageLive(_17);
- _17 = _3;
+ nop;
StorageLive(_16);
_16 = _2;
StorageLive(_17);
_17 = _3;
- _15 = Add(move _16, move _17);
- StorageDead(_17);
- StorageDead(_16);
- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
+ _15 = Add(_2, _3);
StorageDead(_17);
StorageDead(_16);
- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
+ _14 = opaque::<u8>(_15) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_15);
+ nop;
StorageDead(_14);
StorageLive(_18);
- StorageLive(_19);
- StorageLive(_20);
- _20 = _2;
- StorageLive(_21);
- _21 = _3;
StorageLive(_19);
StorageLive(_20);
_20 = _2;
StorageLive(_21);
_21 = _3;
- _19 = Add(move _20, move _21);
- StorageDead(_21);
- StorageDead(_20);
+ _19 = _15;
StorageDead(_21);
StorageDead(_20);
- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind unreachable];
+ _18 = opaque::<u8>(_15) -> [return: bb6, unwind unreachable];
}
bb6: {
- StorageDead(_19);
StorageDead(_19);
StorageDead(_18);
- _4 = const ();
_4 = const ();
goto -> bb7;
}
bb7: {
- StorageDead(_5);
- StorageDead(_4);
StorageDead(_5);
StorageDead(_4);
StorageLive(_22);
- StorageLive(_23);
- StorageLive(_24);
- _24 = _2;
- StorageLive(_25);
- _25 = _3;
+ nop;
StorageLive(_24);
_24 = _2;
StorageLive(_25);
_25 = _3;
- _23 = Add(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
+ _23 = Add(_2, _3);
StorageDead(_25);
StorageDead(_24);
- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
+ _22 = opaque::<u8>(_23) -> [return: bb8, unwind unreachable];
}
bb8: {
- StorageDead(_23);
+ nop;
StorageDead(_22);
- StorageLive(_26);
- _26 = _1;
StorageLive(_26);
_26 = _1;
- switchInt(move _26) -> [0: bb11, otherwise: bb9];
+ switchInt(_1) -> [0: bb11, otherwise: bb9];
}
bb9: {
StorageLive(_27);
- StorageLive(_28);
- StorageLive(_29);
- _29 = _2;
- StorageLive(_30);
- _30 = _3;
StorageLive(_28);
StorageLive(_29);
_29 = _2;
StorageLive(_30);
_30 = _3;
- _28 = Add(move _29, move _30);
- StorageDead(_30);
- StorageDead(_29);
+ _28 = _23;
StorageDead(_30);
StorageDead(_29);
- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind unreachable];
+ _27 = opaque::<u8>(_23) -> [return: bb10, unwind unreachable];
}
bb10: {
- StorageDead(_28);
StorageDead(_28);
StorageDead(_27);
_0 = const ();
goto -> bb13;
@ -171,27 +180,28 @@
bb11: {
StorageLive(_31);
- StorageLive(_32);
- StorageLive(_33);
- _33 = _2;
- StorageLive(_34);
- _34 = _3;
StorageLive(_32);
StorageLive(_33);
_33 = _2;
StorageLive(_34);
_34 = _3;
- _32 = Add(move _33, move _34);
- StorageDead(_34);
- StorageDead(_33);
+ _32 = _23;
StorageDead(_34);
StorageDead(_33);
- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind unreachable];
+ _31 = opaque::<u8>(_23) -> [return: bb12, unwind unreachable];
}
bb12: {
- StorageDead(_32);
StorageDead(_32);
StorageDead(_31);
_0 = const ();
goto -> bb13;
}
bb13: {
- StorageDead(_26);
StorageDead(_26);
return;
}
}

View File

@ -39,9 +39,9 @@
let mut _34: u8;
bb0: {
- StorageLive(_4);
- StorageLive(_5);
- _5 = _1;
StorageLive(_4);
StorageLive(_5);
_5 = _1;
- switchInt(move _5) -> [0: bb4, otherwise: bb1];
+ switchInt(_1) -> [0: bb4, otherwise: bb1];
}
@ -49,121 +49,130 @@
bb1: {
StorageLive(_6);
- StorageLive(_7);
- StorageLive(_8);
- _8 = _2;
- StorageLive(_9);
- _9 = _3;
+ nop;
StorageLive(_8);
_8 = _2;
StorageLive(_9);
_9 = _3;
- _7 = Add(move _8, move _9);
- StorageDead(_9);
- StorageDead(_8);
- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
+ _7 = Add(_2, _3);
StorageDead(_9);
StorageDead(_8);
- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
+ _6 = opaque::<u8>(_7) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_7);
+ nop;
StorageDead(_6);
StorageLive(_10);
- StorageLive(_11);
- StorageLive(_12);
- _12 = _2;
- StorageLive(_13);
- _13 = _3;
StorageLive(_11);
StorageLive(_12);
_12 = _2;
StorageLive(_13);
_13 = _3;
- _11 = Add(move _12, move _13);
- StorageDead(_13);
- StorageDead(_12);
+ _11 = _7;
StorageDead(_13);
StorageDead(_12);
- _10 = opaque::<u8>(move _11) -> [return: bb3, unwind continue];
+ _10 = opaque::<u8>(_7) -> [return: bb3, unwind continue];
}
bb3: {
- StorageDead(_11);
StorageDead(_11);
StorageDead(_10);
- _4 = const ();
_4 = const ();
goto -> bb7;
}
bb4: {
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
- _16 = _2;
- StorageLive(_17);
- _17 = _3;
+ nop;
StorageLive(_16);
_16 = _2;
StorageLive(_17);
_17 = _3;
- _15 = Add(move _16, move _17);
- StorageDead(_17);
- StorageDead(_16);
- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
+ _15 = Add(_2, _3);
StorageDead(_17);
StorageDead(_16);
- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
+ _14 = opaque::<u8>(_15) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_15);
+ nop;
StorageDead(_14);
StorageLive(_18);
- StorageLive(_19);
- StorageLive(_20);
- _20 = _2;
- StorageLive(_21);
- _21 = _3;
StorageLive(_19);
StorageLive(_20);
_20 = _2;
StorageLive(_21);
_21 = _3;
- _19 = Add(move _20, move _21);
- StorageDead(_21);
- StorageDead(_20);
+ _19 = _15;
StorageDead(_21);
StorageDead(_20);
- _18 = opaque::<u8>(move _19) -> [return: bb6, unwind continue];
+ _18 = opaque::<u8>(_15) -> [return: bb6, unwind continue];
}
bb6: {
- StorageDead(_19);
StorageDead(_19);
StorageDead(_18);
- _4 = const ();
_4 = const ();
goto -> bb7;
}
bb7: {
- StorageDead(_5);
- StorageDead(_4);
StorageDead(_5);
StorageDead(_4);
StorageLive(_22);
- StorageLive(_23);
- StorageLive(_24);
- _24 = _2;
- StorageLive(_25);
- _25 = _3;
+ nop;
StorageLive(_24);
_24 = _2;
StorageLive(_25);
_25 = _3;
- _23 = Add(move _24, move _25);
- StorageDead(_25);
- StorageDead(_24);
- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
+ _23 = Add(_2, _3);
StorageDead(_25);
StorageDead(_24);
- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
+ _22 = opaque::<u8>(_23) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_23);
+ nop;
StorageDead(_22);
- StorageLive(_26);
- _26 = _1;
StorageLive(_26);
_26 = _1;
- switchInt(move _26) -> [0: bb11, otherwise: bb9];
+ switchInt(_1) -> [0: bb11, otherwise: bb9];
}
bb9: {
StorageLive(_27);
- StorageLive(_28);
- StorageLive(_29);
- _29 = _2;
- StorageLive(_30);
- _30 = _3;
StorageLive(_28);
StorageLive(_29);
_29 = _2;
StorageLive(_30);
_30 = _3;
- _28 = Add(move _29, move _30);
- StorageDead(_30);
- StorageDead(_29);
+ _28 = _23;
StorageDead(_30);
StorageDead(_29);
- _27 = opaque::<u8>(move _28) -> [return: bb10, unwind continue];
+ _27 = opaque::<u8>(_23) -> [return: bb10, unwind continue];
}
bb10: {
- StorageDead(_28);
StorageDead(_28);
StorageDead(_27);
_0 = const ();
goto -> bb13;
@ -171,27 +180,28 @@
bb11: {
StorageLive(_31);
- StorageLive(_32);
- StorageLive(_33);
- _33 = _2;
- StorageLive(_34);
- _34 = _3;
StorageLive(_32);
StorageLive(_33);
_33 = _2;
StorageLive(_34);
_34 = _3;
- _32 = Add(move _33, move _34);
- StorageDead(_34);
- StorageDead(_33);
+ _32 = _23;
StorageDead(_34);
StorageDead(_33);
- _31 = opaque::<u8>(move _32) -> [return: bb12, unwind continue];
+ _31 = opaque::<u8>(_23) -> [return: bb12, unwind continue];
}
bb12: {
- StorageDead(_32);
StorageDead(_32);
StorageDead(_31);
_0 = const ();
goto -> bb13;
}
bb13: {
- StorageDead(_26);
StorageDead(_26);
return;
}
}

View File

@ -20,6 +20,24 @@
let mut _15: *mut impl Sized;
let _16: ();
let mut _17: *mut impl Sized;
let _18: &mut impl Sized;
let mut _20: S<&mut impl Sized>;
let mut _21: &mut impl Sized;
let _22: ();
let mut _23: &impl Sized;
let _24: ();
let mut _25: &mut impl Sized;
let _26: ();
let mut _27: *const impl Sized;
let _28: ();
let mut _29: *mut impl Sized;
scope 1 {
debug r => _18;
let _19: &mut impl Sized;
scope 2 {
debug s => _19;
}
}
bb0: {
StorageLive(_2);
@ -94,11 +112,68 @@
bb8: {
StorageDead(_17);
StorageDead(_16);
_0 = const ();
drop(_1) -> [return: bb9, unwind unreachable];
- StorageLive(_18);
+ nop;
_18 = &mut _1;
StorageLive(_19);
StorageLive(_20);
StorageLive(_21);
- _21 = move _18;
- _20 = S::<&mut impl Sized>(move _21);
+ _21 = _18;
+ _20 = S::<&mut impl Sized>(_18);
StorageDead(_21);
- _19 = move (_20.0: &mut impl Sized);
+ _19 = _18;
StorageDead(_20);
StorageLive(_22);
StorageLive(_23);
- _23 = &(*_19);
+ _23 = &(*_18);
_22 = opaque::<&impl Sized>(move _23) -> [return: bb9, unwind unreachable];
}
bb9: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_24);
StorageLive(_25);
- _25 = &mut (*_19);
+ _25 = &mut (*_18);
_24 = opaque::<&mut impl Sized>(move _25) -> [return: bb10, unwind unreachable];
}
bb10: {
StorageDead(_25);
StorageDead(_24);
StorageLive(_26);
StorageLive(_27);
- _27 = &raw const (*_19);
+ _27 = &raw const (*_18);
_26 = opaque::<*const impl Sized>(move _27) -> [return: bb11, unwind unreachable];
}
bb11: {
StorageDead(_27);
StorageDead(_26);
StorageLive(_28);
StorageLive(_29);
- _29 = &raw mut (*_19);
+ _29 = &raw mut (*_18);
_28 = opaque::<*mut impl Sized>(move _29) -> [return: bb12, unwind unreachable];
}
bb12: {
StorageDead(_29);
StorageDead(_28);
_0 = const ();
StorageDead(_19);
- StorageDead(_18);
+ nop;
drop(_1) -> [return: bb13, unwind unreachable];
}
bb13: {
return;
}
}

View File

@ -20,12 +20,30 @@
let mut _15: *mut impl Sized;
let _16: ();
let mut _17: *mut impl Sized;
let _18: &mut impl Sized;
let mut _20: S<&mut impl Sized>;
let mut _21: &mut impl Sized;
let _22: ();
let mut _23: &impl Sized;
let _24: ();
let mut _25: &mut impl Sized;
let _26: ();
let mut _27: *const impl Sized;
let _28: ();
let mut _29: *mut impl Sized;
scope 1 {
debug r => _18;
let _19: &mut impl Sized;
scope 2 {
debug s => _19;
}
}
bb0: {
StorageLive(_2);
StorageLive(_3);
_3 = &_1;
_2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb10];
_2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb14];
}
bb1: {
@ -34,7 +52,7 @@
StorageLive(_4);
StorageLive(_5);
_5 = &_1;
_4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb10];
_4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb14];
}
bb2: {
@ -43,7 +61,7 @@
StorageLive(_6);
StorageLive(_7);
_7 = &mut _1;
_6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb10];
_6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb14];
}
bb3: {
@ -52,7 +70,7 @@
StorageLive(_8);
StorageLive(_9);
_9 = &mut _1;
_8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb10];
_8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb14];
}
bb4: {
@ -61,7 +79,7 @@
StorageLive(_10);
StorageLive(_11);
_11 = &raw const _1;
_10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb10];
_10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb14];
}
bb5: {
@ -70,7 +88,7 @@
StorageLive(_12);
StorageLive(_13);
_13 = &raw const _1;
_12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb10];
_12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb14];
}
bb6: {
@ -79,7 +97,7 @@
StorageLive(_14);
StorageLive(_15);
_15 = &raw mut _1;
_14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb10];
_14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb14];
}
bb7: {
@ -88,25 +106,82 @@
StorageLive(_16);
StorageLive(_17);
_17 = &raw mut _1;
_16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb10];
_16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb14];
}
bb8: {
StorageDead(_17);
StorageDead(_16);
_0 = const ();
drop(_1) -> [return: bb9, unwind: bb11];
- StorageLive(_18);
+ nop;
_18 = &mut _1;
StorageLive(_19);
StorageLive(_20);
StorageLive(_21);
- _21 = move _18;
- _20 = S::<&mut impl Sized>(move _21);
+ _21 = _18;
+ _20 = S::<&mut impl Sized>(_18);
StorageDead(_21);
- _19 = move (_20.0: &mut impl Sized);
+ _19 = _18;
StorageDead(_20);
StorageLive(_22);
StorageLive(_23);
- _23 = &(*_19);
+ _23 = &(*_18);
_22 = opaque::<&impl Sized>(move _23) -> [return: bb9, unwind: bb14];
}
bb9: {
StorageDead(_23);
StorageDead(_22);
StorageLive(_24);
StorageLive(_25);
- _25 = &mut (*_19);
+ _25 = &mut (*_18);
_24 = opaque::<&mut impl Sized>(move _25) -> [return: bb10, unwind: bb14];
}
bb10: {
StorageDead(_25);
StorageDead(_24);
StorageLive(_26);
StorageLive(_27);
- _27 = &raw const (*_19);
+ _27 = &raw const (*_18);
_26 = opaque::<*const impl Sized>(move _27) -> [return: bb11, unwind: bb14];
}
bb11: {
StorageDead(_27);
StorageDead(_26);
StorageLive(_28);
StorageLive(_29);
- _29 = &raw mut (*_19);
+ _29 = &raw mut (*_18);
_28 = opaque::<*mut impl Sized>(move _29) -> [return: bb12, unwind: bb14];
}
bb12: {
StorageDead(_29);
StorageDead(_28);
_0 = const ();
StorageDead(_19);
- StorageDead(_18);
+ nop;
drop(_1) -> [return: bb13, unwind: bb15];
}
bb13: {
return;
}
bb10 (cleanup): {
drop(_1) -> [return: bb11, unwind terminate(cleanup)];
bb14 (cleanup): {
drop(_1) -> [return: bb15, unwind terminate(cleanup)];
}
bb11 (cleanup): {
bb15 (cleanup): {
resume;
}
}

View File

@ -0,0 +1,79 @@
- // MIR for `repeat` before GVN
+ // MIR for `repeat` after GVN
fn repeat() -> () {
let mut _0: ();
let _1: i32;
let mut _3: i32;
let mut _4: i32;
let mut _5: i32;
let mut _6: i32;
let mut _7: i32;
let mut _8: i32;
let mut _9: i32;
let mut _10: i32;
let mut _11: i32;
let mut _12: i32;
scope 1 {
debug val => _1;
let _2: [i32; 10];
scope 2 {
debug array => _2;
}
}
bb0: {
- StorageLive(_1);
+ nop;
_1 = const 5_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
+ _3 = const 5_i32;
StorageLive(_4);
- _4 = _1;
+ _4 = const 5_i32;
StorageLive(_5);
- _5 = _1;
+ _5 = const 5_i32;
StorageLive(_6);
- _6 = _1;
+ _6 = const 5_i32;
StorageLive(_7);
- _7 = _1;
+ _7 = const 5_i32;
StorageLive(_8);
- _8 = _1;
+ _8 = const 5_i32;
StorageLive(_9);
- _9 = _1;
+ _9 = const 5_i32;
StorageLive(_10);
- _10 = _1;
+ _10 = const 5_i32;
StorageLive(_11);
- _11 = _1;
+ _11 = const 5_i32;
StorageLive(_12);
- _12 = _1;
- _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12];
+ _12 = const 5_i32;
+ _2 = [const 5_i32; 10];
StorageDead(_12);
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
StorageDead(_6);
StorageDead(_5);
StorageDead(_4);
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
return;
}
}

View File

@ -0,0 +1,79 @@
- // MIR for `repeat` before GVN
+ // MIR for `repeat` after GVN
fn repeat() -> () {
let mut _0: ();
let _1: i32;
let mut _3: i32;
let mut _4: i32;
let mut _5: i32;
let mut _6: i32;
let mut _7: i32;
let mut _8: i32;
let mut _9: i32;
let mut _10: i32;
let mut _11: i32;
let mut _12: i32;
scope 1 {
debug val => _1;
let _2: [i32; 10];
scope 2 {
debug array => _2;
}
}
bb0: {
- StorageLive(_1);
+ nop;
_1 = const 5_i32;
StorageLive(_2);
StorageLive(_3);
- _3 = _1;
+ _3 = const 5_i32;
StorageLive(_4);
- _4 = _1;
+ _4 = const 5_i32;
StorageLive(_5);
- _5 = _1;
+ _5 = const 5_i32;
StorageLive(_6);
- _6 = _1;
+ _6 = const 5_i32;
StorageLive(_7);
- _7 = _1;
+ _7 = const 5_i32;
StorageLive(_8);
- _8 = _1;
+ _8 = const 5_i32;
StorageLive(_9);
- _9 = _1;
+ _9 = const 5_i32;
StorageLive(_10);
- _10 = _1;
+ _10 = const 5_i32;
StorageLive(_11);
- _11 = _1;
+ _11 = const 5_i32;
StorageLive(_12);
- _12 = _1;
- _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12];
+ _12 = const 5_i32;
+ _2 = [const 5_i32; 10];
StorageDead(_12);
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
StorageDead(_6);
StorageDead(_5);
StorageDead(_4);
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
return;
}
}

View File

@ -23,11 +23,11 @@
bb0: {
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _3 = [move _4; N];
- StorageDead(_4);
+ _3 = [_1; N];
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
@ -40,8 +40,10 @@
}
bb1: {
_6 = _3[_7];
_5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
- _6 = _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
+ _6 = _1;
+ _5 = opaque::<T>(_1) -> [return: bb2, unwind unreachable];
}
bb2: {
@ -55,13 +57,16 @@
- _13 = Len(_3);
- _14 = Lt(_12, _13);
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind unreachable];
+ _13 = _8;
+ _14 = Lt(_2, _8);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind unreachable];
}
bb3: {
_11 = _3[_12];
_10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
- _11 = _3[_12];
- _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
+ _11 = _1;
+ _10 = opaque::<T>(_1) -> [return: bb4, unwind unreachable];
}
bb4: {

View File

@ -23,11 +23,11 @@
bb0: {
StorageLive(_3);
- StorageLive(_4);
- _4 = _1;
StorageLive(_4);
_4 = _1;
- _3 = [move _4; N];
- StorageDead(_4);
+ _3 = [_1; N];
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
@ -40,8 +40,10 @@
}
bb1: {
_6 = _3[_7];
_5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
- _6 = _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
+ _6 = _1;
+ _5 = opaque::<T>(_1) -> [return: bb2, unwind continue];
}
bb2: {
@ -55,13 +57,16 @@
- _13 = Len(_3);
- _14 = Lt(_12, _13);
- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue];
+ _13 = _8;
+ _14 = Lt(_2, _8);
+ assert(move _14, "index out of bounds: the length is {} but the index is {}", _8, _2) -> [success: bb3, unwind continue];
}
bb3: {
_11 = _3[_12];
_10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
- _11 = _3[_12];
- _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
+ _11 = _1;
+ _10 = opaque::<T>(_1) -> [return: bb4, unwind continue];
}
bb4: {

View File

@ -1,56 +1,133 @@
// skip-filecheck
// unit-test: GVN
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// only-64bit
#![feature(raw_ref_op)]
#![feature(rustc_attrs)]
#![feature(custom_mir)]
#![feature(core_intrinsics)]
#![allow(unconditional_panic)]
use std::intrinsics::mir::*;
use std::mem::transmute;
struct S<T>(T);
fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
// CHECK-LABEL: fn subexpression_elimination(
// CHECK: [[add:_.*]] = Add(_1, _2);
// CHECK: opaque::<u64>([[add]])
opaque(x + y);
// CHECK: [[mul:_.*]] = Mul(_1, _2);
// CHECK: opaque::<u64>([[mul]])
opaque(x * y);
// CHECK: [[sub:_.*]] = Sub(_1, _2);
// CHECK: opaque::<u64>([[sub]])
opaque(x - y);
// CHECK: [[div:_.*]] = Div(_1, _2);
// CHECK: opaque::<u64>([[div]])
opaque(x / y);
// CHECK: [[rem:_.*]] = Rem(_1, _2);
// CHECK: opaque::<u64>([[rem]])
opaque(x % y);
// CHECK: [[and:_.*]] = BitAnd(_1, _2);
// CHECK: opaque::<u64>([[and]])
opaque(x & y);
// CHECK: [[or:_.*]] = BitOr(_1, _2);
// CHECK: opaque::<u64>([[or]])
opaque(x | y);
// CHECK: [[xor:_.*]] = BitXor(_1, _2);
// CHECK: opaque::<u64>([[xor]])
opaque(x ^ y);
// CHECK: [[shl:_.*]] = Shl(_1, _2);
// CHECK: opaque::<u64>([[shl]])
opaque(x << y);
// CHECK: [[shr:_.*]] = Shr(_1, _2);
// CHECK: opaque::<u64>([[shr]])
opaque(x >> y);
// CHECK: [[int:_.*]] = _1 as u32 (IntToInt);
// CHECK: opaque::<u32>([[int]])
opaque(x as u32);
// CHECK: [[float:_.*]] = _1 as f32 (IntToFloat);
// CHECK: opaque::<f32>([[float]])
opaque(x as f32);
// CHECK: [[wrap:_.*]] = S::<u64>(_1);
// CHECK: opaque::<S<u64>>([[wrap]])
opaque(S(x));
// CHECK: opaque::<u64>(_1)
opaque(S(x).0);
// Those are duplicates to substitute somehow.
opaque((x + y) + z);
opaque((x * y) + z);
opaque((x - y) + z);
opaque((x / y) + z);
opaque((x % y) + z);
opaque((x & y) + z);
opaque((x | y) + z);
opaque((x ^ y) + z);
opaque((x << y) + z);
opaque((x >> y) + z);
// CHECK: opaque::<u64>([[add]])
opaque(x + y);
// CHECK: opaque::<u64>([[mul]])
opaque(x * y);
// CHECK: opaque::<u64>([[sub]])
opaque(x - y);
// CHECK: opaque::<u64>([[div]])
opaque(x / y);
// CHECK: opaque::<u64>([[rem]])
opaque(x % y);
// CHECK: opaque::<u64>([[and]])
opaque(x & y);
// CHECK: opaque::<u64>([[or]])
opaque(x | y);
// CHECK: opaque::<u64>([[xor]])
opaque(x ^ y);
// CHECK: opaque::<u64>([[shl]])
opaque(x << y);
// CHECK: opaque::<u64>([[shr]])
opaque(x >> y);
// CHECK: opaque::<u32>([[int]])
opaque(x as u32);
// CHECK: opaque::<f32>([[float]])
opaque(x as f32);
// CHECK: opaque::<S<u64>>([[wrap]])
opaque(S(x));
// CHECK: opaque::<u64>(_1)
opaque(S(x).0);
// We can substitute through a complex expression.
// CHECK: [[compound:_.*]] = Sub([[mul]], _2);
// CHECK: opaque::<u64>([[compound]])
// CHECK: opaque::<u64>([[compound]])
opaque((x * y) - y);
opaque((x * y) - y);
// We can substitute through an immutable reference too.
// CHECK: [[ref:_.*]] = &_3;
// CHECK: [[deref:_.*]] = (*[[ref]]);
// CHECK: [[addref:_.*]] = Add([[deref]], _1);
// CHECK: opaque::<u64>([[addref]])
// CHECK: opaque::<u64>([[addref]])
let a = &z;
opaque(*a + x);
opaque(*a + x);
// But not through a mutable reference or a pointer.
// CHECK: [[mut:_.*]] = &mut _3;
// CHECK: [[addmut:_.*]] = Add(
// CHECK: opaque::<u64>(move [[addmut]])
// CHECK: [[addmut2:_.*]] = Add(
// CHECK: opaque::<u64>(move [[addmut2]])
let b = &mut z;
opaque(*b + x);
opaque(*b + x);
unsafe {
// CHECK: [[raw:_.*]] = &raw const _3;
// CHECK: [[addraw:_.*]] = Add(
// CHECK: opaque::<u64>(move [[addraw]])
// CHECK: [[addraw2:_.*]] = Add(
// CHECK: opaque::<u64>(move [[addraw2]])
let c = &raw const z;
opaque(*c + x);
opaque(*c + x);
// CHECK: [[ptr:_.*]] = &raw mut _3;
// CHECK: [[addptr:_.*]] = Add(
// CHECK: opaque::<u64>(move [[addptr]])
// CHECK: [[addptr2:_.*]] = Add(
// CHECK: opaque::<u64>(move [[addptr2]])
let d = &raw mut z;
opaque(*d + x);
opaque(*d + x);
@ -58,13 +135,21 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
// We can substitute again, but not with the earlier computations.
// Important: `e` is not `a`!
// CHECK: [[ref2:_.*]] = &_3;
// CHECK: [[deref2:_.*]] = (*[[ref2]]);
// CHECK: [[addref2:_.*]] = Add([[deref2]], _1);
// CHECK: opaque::<u64>([[addref2]])
// CHECK: opaque::<u64>([[addref2]])
let e = &z;
opaque(*e + x);
opaque(*e + x);
}
fn wrap_unwrap<T: Copy>(x: T) -> T {
// CHECK-LABEL: fn wrap_unwrap(
// CHECK: [[some:_.*]] = Option::<T>::Some(_1);
// CHECK: switchInt(const 1_isize)
// CHECK: _0 = _1;
match Some(x) {
Some(y) => y,
None => panic!(),
@ -72,163 +157,464 @@ fn wrap_unwrap<T: Copy>(x: T) -> T {
}
fn repeated_index<T: Copy, const N: usize>(x: T, idx: usize) {
// CHECK-LABEL: fn repeated_index(
// CHECK: [[a:_.*]] = [_1; N];
let a = [x; N];
// CHECK: opaque::<T>(_1)
opaque(a[0]);
// CHECK: opaque::<T>(_1)
opaque(a[idx]);
}
/// Verify symbolic integer arithmetic simplifications.
fn arithmetic(x: u64) {
// CHECK-LABEL: fn arithmetic(
// CHECK: [[add:_.*]] = Add(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[add]])
opaque(x + 0);
// CHECK: [[sub:_.*]] = Sub(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[sub]])
opaque(x - 0);
// CHECK: [[mul0:_.*]] = Mul(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[mul0]])
opaque(x * 0);
// CHECK: [[mul1:_.*]] = Mul(_1, const 1_u64);
// CHECK: opaque::<u64>(move [[mul1]])
opaque(x * 1);
// CHECK: [[div0:_.*]] = Div(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[div0]])
opaque(x / 0);
// CHECK: [[div1:_.*]] = Div(_1, const 1_u64);
// CHECK: opaque::<u64>(move [[div1]])
opaque(x / 1);
// CHECK: [[zdiv:_.*]] = Div(const 0_u64, _1);
// CHECK: opaque::<u64>(move [[zdiv]])
opaque(0 / x);
// CHECK: [[odiv:_.*]] = Div(const 1_u64, _1);
// CHECK: opaque::<u64>(move [[odiv]])
opaque(1 / x);
// CHECK: [[rem0:_.*]] = Rem(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[rem0]])
opaque(x % 0);
// CHECK: [[rem1:_.*]] = Rem(_1, const 1_u64);
// CHECK: opaque::<u64>(move [[rem1]])
opaque(x % 1);
// CHECK: [[zrem:_.*]] = Rem(const 0_u64, _1);
// CHECK: opaque::<u64>(move [[zrem]])
opaque(0 % x);
// CHECK: [[orem:_.*]] = Rem(const 1_u64, _1);
// CHECK: opaque::<u64>(move [[orem]])
opaque(1 % x);
// CHECK: [[and:_.*]] = BitAnd(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[and]])
opaque(x & 0);
// CHECK: [[or:_.*]] = BitOr(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[or]])
opaque(x | 0);
// CHECK: [[xor:_.*]] = BitXor(_1, const 0_u64);
// CHECK: opaque::<u64>(move [[xor]])
opaque(x ^ 0);
// CHECK: [[shr:_.*]] = Shr(_1, const 0_i32);
// CHECK: opaque::<u64>(move [[shr]])
opaque(x >> 0);
// CHECK: [[shl:_.*]] = Shl(_1, const 0_i32);
// CHECK: opaque::<u64>(move [[shl]])
opaque(x << 0);
}
fn comparison(x: u64, y: u64) {
// CHECK-LABEL: fn comparison(
// CHECK: [[eqxx:_.*]] = Eq(_1, _1);
// CHECK: opaque::<bool>(move [[eqxx]])
opaque(x == x);
// CHECK: [[nexx:_.*]] = Ne(_1, _1);
// CHECK: opaque::<bool>(move [[nexx]])
opaque(x != x);
// CHECK: [[eqxy:_.*]] = Eq(_1, _2);
// CHECK: opaque::<bool>(move [[eqxy]])
opaque(x == y);
// CHECK: [[nexy:_.*]] = Ne(_1, _2);
// CHECK: opaque::<bool>(move [[nexy]])
opaque(x != y);
}
/// Verify symbolic integer arithmetic simplifications on checked ops.
#[rustc_inherit_overflow_checks]
fn arithmetic_checked(x: u64) {
// CHECK-LABEL: fn arithmetic_checked(
// CHECK: [[cadd:_.*]] = CheckedAdd(_1, const 0_u64);
// CHECK: [[add:_.*]] = move ([[cadd]].0: u64);
// CHECK: opaque::<u64>(move [[add]])
opaque(x + 0);
// CHECK: [[csub:_.*]] = CheckedSub(_1, const 0_u64);
// CHECK: [[sub:_.*]] = move ([[csub]].0: u64);
// CHECK: opaque::<u64>(move [[sub]])
opaque(x - 0);
// CHECK: [[cmul0:_.*]] = CheckedMul(_1, const 0_u64);
// CHECK: [[mul0:_.*]] = move ([[cmul0]].0: u64);
// CHECK: opaque::<u64>(move [[mul0]])
opaque(x * 0);
// CHECK: [[cmul1:_.*]] = CheckedMul(_1, const 1_u64);
// CHECK: [[mul1:_.*]] = move ([[cmul1]].0: u64);
// CHECK: opaque::<u64>(move [[mul1]])
opaque(x * 1);
opaque(x / 0);
opaque(x / 1);
opaque(0 / x);
opaque(1 / x);
opaque(x % 0);
opaque(x % 1);
opaque(0 % x);
opaque(1 % x);
opaque(x & 0);
opaque(x | 0);
opaque(x ^ 0);
opaque(x >> 0);
opaque(x << 0);
}
/// Verify that we do not apply arithmetic simplifications on floats.
fn arithmetic_float(x: f64) {
// CHECK-LABEL: fn arithmetic_float(
// CHECK: [[add:_.*]] = Add(_1, const 0f64);
// CHECK: opaque::<f64>(move [[add]])
opaque(x + 0.);
// CHECK: [[sub:_.*]] = Sub(_1, const 0f64);
// CHECK: opaque::<f64>(move [[sub]])
opaque(x - 0.);
// CHECK: [[mul:_.*]] = Mul(_1, const 0f64);
// CHECK: opaque::<f64>(move [[mul]])
opaque(x * 0.);
// CHECK: [[div0:_.*]] = Div(_1, const 0f64);
// CHECK: opaque::<f64>(move [[div0]])
opaque(x / 0.);
// CHECK: [[zdiv:_.*]] = Div(const 0f64, _1);
// CHECK: opaque::<f64>(move [[zdiv]])
opaque(0. / x);
// CHECK: [[rem0:_.*]] = Rem(_1, const 0f64);
// CHECK: opaque::<f64>(move [[rem0]])
opaque(x % 0.);
// CHECK: [[zrem:_.*]] = Rem(const 0f64, _1);
// CHECK: opaque::<f64>(move [[zrem]])
opaque(0. % x);
// Those are not simplifiable to `true`/`false`, thanks to NaNs.
// CHECK: [[eq:_.*]] = Eq(_1, _1);
// CHECK: opaque::<bool>(move [[eq]])
opaque(x == x);
// CHECK: [[ne:_.*]] = Ne(_1, _1);
// CHECK: opaque::<bool>(move [[ne]])
opaque(x != x);
}
fn cast() {
// CHECK-LABEL: fn cast(
let i = 1_i64;
let u = 1_u64;
let f = 1_f64;
// CHECK: opaque::<u8>(const 1_u8)
opaque(i as u8);
// CHECK: opaque::<u16>(const 1_u16)
opaque(i as u16);
// CHECK: opaque::<u32>(const 1_u32)
opaque(i as u32);
// CHECK: opaque::<u64>(const 1_u64)
opaque(i as u64);
// CHECK: opaque::<i8>(const 1_i8)
opaque(i as i8);
// CHECK: opaque::<i16>(const 1_i16)
opaque(i as i16);
// CHECK: opaque::<i32>(const 1_i32)
opaque(i as i32);
// CHECK: opaque::<i64>(const 1_i64)
opaque(i as i64);
// CHECK: opaque::<f32>(const 1f32)
opaque(i as f32);
// CHECK: opaque::<f64>(const 1f64)
opaque(i as f64);
// CHECK: opaque::<u8>(const 1_u8)
opaque(u as u8);
// CHECK: opaque::<u16>(const 1_u16)
opaque(u as u16);
// CHECK: opaque::<u32>(const 1_u32)
opaque(u as u32);
// CHECK: opaque::<u64>(const 1_u64)
opaque(u as u64);
// CHECK: opaque::<i8>(const 1_i8)
opaque(u as i8);
// CHECK: opaque::<i16>(const 1_i16)
opaque(u as i16);
// CHECK: opaque::<i32>(const 1_i32)
opaque(u as i32);
// CHECK: opaque::<i64>(const 1_i64)
opaque(u as i64);
// CHECK: opaque::<f32>(const 1f32)
opaque(u as f32);
// CHECK: opaque::<f64>(const 1f64)
opaque(u as f64);
// CHECK: opaque::<u8>(const 1_u8)
opaque(f as u8);
// CHECK: opaque::<u16>(const 1_u16)
opaque(f as u16);
// CHECK: opaque::<u32>(const 1_u32)
opaque(f as u32);
// CHECK: opaque::<u64>(const 1_u64)
opaque(f as u64);
// CHECK: opaque::<i8>(const 1_i8)
opaque(f as i8);
// CHECK: opaque::<i16>(const 1_i16)
opaque(f as i16);
// CHECK: opaque::<i32>(const 1_i32)
opaque(f as i32);
// CHECK: opaque::<i64>(const 1_i64)
opaque(f as i64);
// CHECK: opaque::<f32>(const 1f32)
opaque(f as f32);
// CHECK: opaque::<f64>(const 1f64)
opaque(f as f64);
}
fn multiple_branches(t: bool, x: u8, y: u8) {
// CHECK-LABEL: fn multiple_branches(
// CHECK: switchInt(_1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]];
if t {
opaque(x + y); // a
opaque(x + y); // should reuse a
// CHECK: [[bbt]]: {
// CHECK: [[a:_.*]] = Add(_2, _3);
// CHECK: opaque::<u8>([[a]])
// CHECK: opaque::<u8>([[a]])
// CHECK: goto -> [[bbc:bb.*]];
opaque(x + y);
opaque(x + y);
} else {
opaque(x + y); // b
opaque(x + y); // shoud reuse b
// CHECK: [[bbf]]: {
// CHECK: [[b:_.*]] = Add(_2, _3);
// CHECK: opaque::<u8>([[b]])
// CHECK: opaque::<u8>([[b]])
// CHECK: goto -> [[bbc:bb.*]];
opaque(x + y);
opaque(x + y);
}
opaque(x + y); // c
// Neither `a` nor `b` dominate `c`, so we cannot reuse any of them.
// CHECK: [[bbc]]: {
// CHECK: [[c:_.*]] = Add(_2, _3);
// CHECK: opaque::<u8>([[c]])
opaque(x + y);
// `c` dominates both calls, so we can reuse it.
if t {
opaque(x + y); // should reuse c
// CHECK: opaque::<u8>([[c]])
opaque(x + y);
} else {
opaque(x + y); // should reuse c
// CHECK: opaque::<u8>([[c]])
opaque(x + y);
}
}
/// Verify that we do not reuse a `&raw? mut?` rvalue.
fn references(mut x: impl Sized) {
// CHECK-LABEL: fn references(
// CHECK: [[ref1:_.*]] = &_1;
// CHECK: opaque::<&impl Sized>(move [[ref1]])
opaque(&x);
opaque(&x); // should not reuse a
// CHECK: [[ref2:_.*]] = &_1;
// CHECK: opaque::<&impl Sized>(move [[ref2]])
opaque(&x);
// CHECK: [[ref3:_.*]] = &mut _1;
// CHECK: opaque::<&mut impl Sized>(move [[ref3]])
opaque(&mut x);
opaque(&mut x); // should not reuse a
// CHECK: [[ref4:_.*]] = &mut _1;
// CHECK: opaque::<&mut impl Sized>(move [[ref4]])
opaque(&mut x);
// CHECK: [[ref5:_.*]] = &raw const _1;
// CHECK: opaque::<*const impl Sized>(move [[ref5]])
opaque(&raw const x);
opaque(&raw const x); // should not reuse a
// CHECK: [[ref6:_.*]] = &raw const _1;
// CHECK: opaque::<*const impl Sized>(move [[ref6]])
opaque(&raw const x);
// CHECK: [[ref7:_.*]] = &raw mut _1;
// CHECK: opaque::<*mut impl Sized>(move [[ref7]])
opaque(&raw mut x);
opaque(&raw mut x); // should not reuse a
// CHECK: [[ref8:_.*]] = &raw mut _1;
// CHECK: opaque::<*mut impl Sized>(move [[ref8]])
opaque(&raw mut x);
let r = &mut x;
let s = S(r).0; // Obfuscate `r`. Following lines should still reborrow `r`.
// CHECK: [[ref9:_.*]] = &mut _1;
// CHECK: [[ref10:_.*]] = &(*[[ref9]]);
// CHECK: opaque::<&impl Sized>(move [[ref10]])
opaque(&*s);
// CHECK: [[ref11:_.*]] = &mut (*[[ref9]]);
// CHECK: opaque::<&mut impl Sized>(move [[ref11]])
opaque(&mut *s);
// CHECK: [[ref12:_.*]] = &raw const (*[[ref9]]);
// CHECK: opaque::<*const impl Sized>(move [[ref12]])
opaque(&raw const *s);
// CHECK: [[ref12:_.*]] = &raw mut (*[[ref9]]);
// CHECK: opaque::<*mut impl Sized>(move [[ref12]])
opaque(&raw mut *s);
}
fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
// CHECK-LABEL: fn dereferences(
// Do not reuse dereferences of `&mut`.
// CHECK: [[st1:_.*]] = (*_1);
// CHECK: opaque::<u32>(move [[st1]])
// CHECK: [[st2:_.*]] = (*_1);
// CHECK: opaque::<u32>(move [[st2]])
opaque(*t);
opaque(*t); // this cannot reuse a, as x is &mut.
opaque(*t);
// Do not reuse dereferences of `*const`.
// CHECK: [[raw:_.*]] = &raw const (*_1);
// CHECK: [[st3:_.*]] = (*[[raw]]);
// CHECK: opaque::<u32>(move [[st3]])
// CHECK: [[st4:_.*]] = (*[[raw]]);
// CHECK: opaque::<u32>(move [[st4]])
let z = &raw const *t;
unsafe { opaque(*z) };
unsafe { opaque(*z) }; // this cannot reuse a, as x is *const.
unsafe { opaque(*z) };
// Do not reuse dereferences of `*mut`.
// CHECK: [[ptr:_.*]] = &raw mut (*_1);
// CHECK: [[st5:_.*]] = (*[[ptr]]);
// CHECK: opaque::<u32>(move [[st5]])
// CHECK: [[st6:_.*]] = (*[[ptr]]);
// CHECK: opaque::<u32>(move [[st6]])
let z = &raw mut *t;
unsafe { opaque(*z) };
unsafe { opaque(*z) }; // this cannot reuse a, as x is *mut.
unsafe { opaque(*z) };
// We can reuse dereferences of `&Freeze`.
// CHECK: [[ref:_.*]] = &(*_1);
// CHECK: [[st7:_.*]] = (*[[ref]]);
// CHECK: opaque::<u32>([[st7]])
// CHECK: opaque::<u32>([[st7]])
let z = &*t;
opaque(*z);
opaque(*z); // this can reuse, as `z` is immutable ref, Freeze and Copy.
opaque(&*z); // but not for a reborrow.
opaque(*z);
// But not in reborrows.
// CHECK: [[reborrow:_.*]] = &(*[[ref]]);
// CHECK: opaque::<&u32>(move [[reborrow]])
opaque(&*z);
// `*u` is not Freeze, so we cannot reuse.
// CHECK: [[st8:_.*]] = (*_2);
// CHECK: opaque::<impl Copy>(move [[st8]])
// CHECK: [[st9:_.*]] = (*_2);
// CHECK: opaque::<impl Copy>(move [[st9]])
opaque(*u);
opaque(*u); // this cannot reuse, as `z` is not Freeze.
opaque(*u);
// `*s` is not Copy, by `(*s).0` is, so we can reuse.
// CHECK: [[st10:_.*]] = ((*_3).0: u32);
// CHECK: opaque::<u32>([[st10]])
// CHECK: opaque::<u32>([[st10]])
opaque(s.0);
opaque(s.0);
opaque(s.0); // *s is not Copy, by (*s).0 is, so we can reuse.
}
fn slices() {
// CHECK-LABEL: fn slices(
// CHECK: {{_.*}} = const "
// CHECK-NOT: {{_.*}} = const "
let s = "my favourite slice"; // This is a `Const::Slice` in MIR.
opaque(s);
let t = s; // This should be the same pointer, so cannot be a `Const::Slice`.
opaque(t);
assert_eq!(s.as_ptr(), t.as_ptr());
let u = unsafe { std::mem::transmute::<&str, &[u8]>(s) };
let u = unsafe { transmute::<&str, &[u8]>(s) };
opaque(u);
assert_eq!(s.as_ptr(), u.as_ptr());
}
#[custom_mir(dialect = "analysis")]
fn duplicate_slice() -> (bool, bool) {
// CHECK-LABEL: fn duplicate_slice(
mir!(
let au: u128;
let bu: u128;
let cu: u128;
let du: u128;
let c: &str;
let d: &str;
{
// CHECK: [[a:_.*]] = (const "a",);
// CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute);
let a = ("a",);
Call(au = transmute::<_, u128>(a.0), bb1)
}
bb1 = {
// CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str))
Call(c = identity(a.0), bb2)
}
bb2 = {
// CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute);
Call(cu = transmute::<_, u128>(c), bb3)
}
bb3 = {
// This slice is different from `a.0`. Hence `bu` is not `au`.
// CHECK: [[b:_.*]] = const "a";
// CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute);
let b = "a";
Call(bu = transmute::<_, u128>(b), bb4)
}
bb4 = {
// This returns a copy of `b`, which is not `a`.
// CHECK: [[d:_.*]] = identity::<&str>([[b]])
Call(d = identity(b), bb5)
}
bb5 = {
// CHECK: [[du:_.*]] = [[d]] as u128 (Transmute);
Call(du = transmute::<_, u128>(d), bb6)
}
bb6 = {
// `direct` must not fold to `true`, as `indirect` will not.
// CHECK: = Eq([[au]], [[bu]]);
// CHECK: = Eq([[cu]], [[du]]);
let direct = au == bu;
let indirect = cu == du;
RET = (direct, indirect);
Return()
}
)
}
fn repeat() {
// CHECK-LABEL: fn repeat(
// CHECK: = [const 5_i32; 10];
let val = 5;
let array = [val, val, val, val, val, val, val, val, val, val];
}
/// Verify that we do not merge fn pointers created by casts.
fn fn_pointers() {
// CHECK-LABEL: fn fn_pointers(
// CHECK: [[f:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer
// CHECK: opaque::<fn(u8) -> u8>([[f]])
let f = identity as fn(u8) -> u8;
opaque(f);
// CHECK: [[g:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer
// CHECK: opaque::<fn(u8) -> u8>([[g]])
let g = identity as fn(u8) -> u8;
opaque(g);
// CHECK: [[cf:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer
// CHECK: opaque::<fn()>([[cf]])
let closure = || {};
let cf = closure as fn();
opaque(cf);
// CHECK: [[cg:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer
// CHECK: opaque::<fn()>([[cg]])
let cg = closure as fn();
opaque(cg);
}
/// Verify that we do not create a `ConstValue::Indirect` backed by a static's AllocId.
#[custom_mir(dialect = "analysis")]
fn indirect_static() {
static A: Option<u8> = None;
mir!({
let ptr = Static(A);
let out = Field::<u8>(Variant(*ptr, 1), 0);
Return()
})
}
fn main() {
subexpression_elimination(2, 4, 5);
wrap_unwrap(5);
repeated_index::<u32, 7>(5, 3);
arithmetic(5);
comparison(5, 6);
arithmetic_checked(5);
arithmetic_float(5.);
cast();
@ -236,15 +622,26 @@ fn main() {
references(5);
dereferences(&mut 5, &6, &S(7));
slices();
let (direct, indirect) = duplicate_slice();
assert_eq!(direct, indirect);
repeat();
fn_pointers();
indirect_static();
}
#[inline(never)]
fn opaque(_: impl Sized) {}
#[inline(never)]
fn identity<T>(x: T) -> T {
x
}
// EMIT_MIR gvn.subexpression_elimination.GVN.diff
// EMIT_MIR gvn.wrap_unwrap.GVN.diff
// EMIT_MIR gvn.repeated_index.GVN.diff
// EMIT_MIR gvn.arithmetic.GVN.diff
// EMIT_MIR gvn.comparison.GVN.diff
// EMIT_MIR gvn.arithmetic_checked.GVN.diff
// EMIT_MIR gvn.arithmetic_float.GVN.diff
// EMIT_MIR gvn.cast.GVN.diff
@ -252,3 +649,7 @@ fn opaque(_: impl Sized) {}
// EMIT_MIR gvn.references.GVN.diff
// EMIT_MIR gvn.dereferences.GVN.diff
// EMIT_MIR gvn.slices.GVN.diff
// EMIT_MIR gvn.duplicate_slice.GVN.diff
// EMIT_MIR gvn.repeat.GVN.diff
// EMIT_MIR gvn.fn_pointers.GVN.diff
// EMIT_MIR gvn.indirect_static.GVN.diff

View File

@ -85,32 +85,35 @@
bb0: {
- StorageLive(_1);
+ nop;
_1 = const "my favourite slice";
StorageLive(_2);
- StorageLive(_3);
- _3 = _1;
StorageLive(_3);
_3 = _1;
- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable];
+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_3);
StorageDead(_3);
StorageDead(_2);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
- StorageLive(_6);
StorageLive(_6);
- _6 = _4;
- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable];
+ _6 = _1;
+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_6);
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
- StorageLive(_9);
+ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
@ -120,28 +123,37 @@
bb3: {
StorageDead(_11);
_9 = &_10;
StorageLive(_12);
- StorageLive(_12);
+ nop;
StorageLive(_13);
StorageLive(_14);
_14 = &(*_4);
- _14 = &(*_4);
+ _14 = &(*_1);
_13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind unreachable];
}
bb4: {
StorageDead(_14);
_12 = &_13;
_8 = (move _9, move _12);
StorageDead(_12);
StorageDead(_9);
- _8 = (move _9, move _12);
- StorageDead(_12);
- StorageDead(_9);
+ _8 = (_9, _12);
+ nop;
+ nop;
StorageLive(_15);
_15 = (_8.0: &*const u8);
- _15 = (_8.0: &*const u8);
+ _15 = _9;
StorageLive(_16);
_16 = (_8.1: &*const u8);
- _16 = (_8.1: &*const u8);
+ _16 = _12;
StorageLive(_17);
StorageLive(_18);
_18 = (*_15);
- _18 = (*_15);
+ _18 = (*_9);
StorageLive(_19);
_19 = (*_16);
- _19 = (*_16);
+ _19 = (*_12);
_17 = Eq(move _18, move _19);
switchInt(move _17) -> [0: bb6, otherwise: bb5];
}
@ -149,22 +161,23 @@
bb5: {
StorageDead(_19);
StorageDead(_18);
- _7 = const ();
_7 = const ();
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
- StorageDead(_7);
StorageDead(_7);
- StorageLive(_29);
+ nop;
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
StorageDead(_30);
StorageLive(_31);
- StorageLive(_32);
- _32 = _29;
StorageLive(_32);
_32 = _29;
- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable];
+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind unreachable];
}
@ -173,30 +186,38 @@
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
_21 = core::panicking::AssertKind::Eq;
- _21 = core::panicking::AssertKind::Eq;
+ nop;
+ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
- StorageLive(_23);
StorageLive(_23);
- _23 = move _21;
+ _23 = const core::panicking::AssertKind::Eq;
StorageLive(_24);
StorageLive(_25);
_25 = &(*_15);
- StorageLive(_25);
- _25 = &(*_15);
+ nop;
+ _25 = &(*_9);
_24 = &(*_25);
StorageLive(_26);
StorageLive(_27);
_27 = &(*_16);
- StorageLive(_27);
- _27 = &(*_16);
+ nop;
+ _27 = &(*_12);
_26 = &(*_27);
StorageLive(_28);
_28 = Option::<Arguments<'_>>::None;
- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind unreachable;
- _22 = assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
+ _22 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, move _28) -> unwind unreachable;
}
bb7: {
- StorageDead(_32);
StorageDead(_32);
StorageDead(_31);
- StorageLive(_33);
StorageLive(_33);
StorageLive(_34);
StorageLive(_35);
- StorageLive(_35);
+ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
@ -206,7 +227,8 @@
bb8: {
StorageDead(_37);
_35 = &_36;
StorageLive(_38);
- StorageLive(_38);
+ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
@ -216,18 +238,25 @@
bb9: {
StorageDead(_40);
_38 = &_39;
_34 = (move _35, move _38);
StorageDead(_38);
StorageDead(_35);
- _34 = (move _35, move _38);
- StorageDead(_38);
- StorageDead(_35);
+ _34 = (_35, _38);
+ nop;
+ nop;
StorageLive(_41);
_41 = (_34.0: &*const u8);
- _41 = (_34.0: &*const u8);
+ _41 = _35;
StorageLive(_42);
_42 = (_34.1: &*const u8);
- _42 = (_34.1: &*const u8);
+ _42 = _38;
StorageLive(_43);
StorageLive(_44);
_44 = (*_41);
- _44 = (*_41);
+ _44 = (*_35);
StorageLive(_45);
_45 = (*_42);
- _45 = (*_42);
+ _45 = (*_38);
_43 = Eq(move _44, move _45);
switchInt(move _43) -> [0: bb11, otherwise: bb10];
}
@ -235,18 +264,20 @@
bb10: {
StorageDead(_45);
StorageDead(_44);
- _33 = const ();
_33 = const ();
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
- StorageDead(_33);
StorageDead(_33);
_0 = const ();
- StorageDead(_29);
+ nop;
StorageDead(_4);
- StorageDead(_1);
+ nop;
return;
}
@ -254,22 +285,29 @@
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
_47 = core::panicking::AssertKind::Eq;
- _47 = core::panicking::AssertKind::Eq;
+ nop;
+ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
- StorageLive(_49);
StorageLive(_49);
- _49 = move _47;
+ _49 = const core::panicking::AssertKind::Eq;
StorageLive(_50);
StorageLive(_51);
_51 = &(*_41);
- StorageLive(_51);
- _51 = &(*_41);
+ nop;
+ _51 = &(*_35);
_50 = &(*_51);
StorageLive(_52);
StorageLive(_53);
_53 = &(*_42);
- StorageLive(_53);
- _53 = &(*_42);
+ nop;
+ _53 = &(*_38);
_52 = &(*_53);
StorageLive(_54);
_54 = Option::<Arguments<'_>>::None;
- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind unreachable;
- _48 = assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
+ _48 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _50, move _52, move _54) -> unwind unreachable;
}
}

View File

@ -85,32 +85,35 @@
bb0: {
- StorageLive(_1);
+ nop;
_1 = const "my favourite slice";
StorageLive(_2);
- StorageLive(_3);
- _3 = _1;
StorageLive(_3);
_3 = _1;
- _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue];
+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind continue];
}
bb1: {
- StorageDead(_3);
StorageDead(_3);
StorageDead(_2);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
- StorageLive(_6);
StorageLive(_6);
- _6 = _4;
- _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue];
+ _6 = _1;
+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue];
}
bb2: {
- StorageDead(_6);
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
StorageLive(_7);
StorageLive(_8);
StorageLive(_9);
- StorageLive(_9);
+ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
@ -120,28 +123,37 @@
bb3: {
StorageDead(_11);
_9 = &_10;
StorageLive(_12);
- StorageLive(_12);
+ nop;
StorageLive(_13);
StorageLive(_14);
_14 = &(*_4);
- _14 = &(*_4);
+ _14 = &(*_1);
_13 = core::str::<impl str>::as_ptr(move _14) -> [return: bb4, unwind continue];
}
bb4: {
StorageDead(_14);
_12 = &_13;
_8 = (move _9, move _12);
StorageDead(_12);
StorageDead(_9);
- _8 = (move _9, move _12);
- StorageDead(_12);
- StorageDead(_9);
+ _8 = (_9, _12);
+ nop;
+ nop;
StorageLive(_15);
_15 = (_8.0: &*const u8);
- _15 = (_8.0: &*const u8);
+ _15 = _9;
StorageLive(_16);
_16 = (_8.1: &*const u8);
- _16 = (_8.1: &*const u8);
+ _16 = _12;
StorageLive(_17);
StorageLive(_18);
_18 = (*_15);
- _18 = (*_15);
+ _18 = (*_9);
StorageLive(_19);
_19 = (*_16);
- _19 = (*_16);
+ _19 = (*_12);
_17 = Eq(move _18, move _19);
switchInt(move _17) -> [0: bb6, otherwise: bb5];
}
@ -149,22 +161,23 @@
bb5: {
StorageDead(_19);
StorageDead(_18);
- _7 = const ();
_7 = const ();
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
- StorageDead(_7);
StorageDead(_7);
- StorageLive(_29);
+ nop;
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
StorageDead(_30);
StorageLive(_31);
- StorageLive(_32);
- _32 = _29;
StorageLive(_32);
_32 = _29;
- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue];
+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind continue];
}
@ -173,30 +186,38 @@
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
_21 = core::panicking::AssertKind::Eq;
- _21 = core::panicking::AssertKind::Eq;
+ nop;
+ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
- StorageLive(_23);
StorageLive(_23);
- _23 = move _21;
+ _23 = const core::panicking::AssertKind::Eq;
StorageLive(_24);
StorageLive(_25);
_25 = &(*_15);
- StorageLive(_25);
- _25 = &(*_15);
+ nop;
+ _25 = &(*_9);
_24 = &(*_25);
StorageLive(_26);
StorageLive(_27);
_27 = &(*_16);
- StorageLive(_27);
- _27 = &(*_16);
+ nop;
+ _27 = &(*_12);
_26 = &(*_27);
StorageLive(_28);
_28 = Option::<Arguments<'_>>::None;
- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind continue;
- _22 = assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
+ _22 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _24, move _26, move _28) -> unwind continue;
}
bb7: {
- StorageDead(_32);
StorageDead(_32);
StorageDead(_31);
- StorageLive(_33);
StorageLive(_33);
StorageLive(_34);
StorageLive(_35);
- StorageLive(_35);
+ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
@ -206,7 +227,8 @@
bb8: {
StorageDead(_37);
_35 = &_36;
StorageLive(_38);
- StorageLive(_38);
+ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
@ -216,18 +238,25 @@
bb9: {
StorageDead(_40);
_38 = &_39;
_34 = (move _35, move _38);
StorageDead(_38);
StorageDead(_35);
- _34 = (move _35, move _38);
- StorageDead(_38);
- StorageDead(_35);
+ _34 = (_35, _38);
+ nop;
+ nop;
StorageLive(_41);
_41 = (_34.0: &*const u8);
- _41 = (_34.0: &*const u8);
+ _41 = _35;
StorageLive(_42);
_42 = (_34.1: &*const u8);
- _42 = (_34.1: &*const u8);
+ _42 = _38;
StorageLive(_43);
StorageLive(_44);
_44 = (*_41);
- _44 = (*_41);
+ _44 = (*_35);
StorageLive(_45);
_45 = (*_42);
- _45 = (*_42);
+ _45 = (*_38);
_43 = Eq(move _44, move _45);
switchInt(move _43) -> [0: bb11, otherwise: bb10];
}
@ -235,18 +264,20 @@
bb10: {
StorageDead(_45);
StorageDead(_44);
- _33 = const ();
_33 = const ();
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
- StorageDead(_33);
StorageDead(_33);
_0 = const ();
- StorageDead(_29);
+ nop;
StorageDead(_4);
- StorageDead(_1);
+ nop;
return;
}
@ -254,22 +285,29 @@
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
_47 = core::panicking::AssertKind::Eq;
- _47 = core::panicking::AssertKind::Eq;
+ nop;
+ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
- StorageLive(_49);
StorageLive(_49);
- _49 = move _47;
+ _49 = const core::panicking::AssertKind::Eq;
StorageLive(_50);
StorageLive(_51);
_51 = &(*_41);
- StorageLive(_51);
- _51 = &(*_41);
+ nop;
+ _51 = &(*_35);
_50 = &(*_51);
StorageLive(_52);
StorageLive(_53);
_53 = &(*_42);
- StorageLive(_53);
- _53 = &(*_42);
+ nop;
+ _53 = &(*_38);
_52 = &(*_53);
StorageLive(_54);
_54 = Option::<Arguments<'_>>::None;
- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind continue;
- _48 = assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
+ _48 = assert_failed::<*const u8, *const u8>(const core::panicking::AssertKind::Eq, move _50, move _52, move _54) -> unwind continue;
}
}

View File

@ -15,13 +15,15 @@
bb0: {
StorageLive(_2);
- StorageLive(_3);
- _3 = _1;
StorageLive(_3);
_3 = _1;
- _2 = Option::<T>::Some(move _3);
- StorageDead(_3);
+ _2 = Option::<T>::Some(_1);
_4 = discriminant(_2);
switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
StorageDead(_3);
- _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ _4 = const 1_isize;
+ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
}
bb1: {
@ -34,10 +36,12 @@
}
bb3: {
- StorageLive(_5);
_5 = ((_2 as Some).0: T);
_0 = _5;
- StorageDead(_5);
StorageLive(_5);
- _5 = ((_2 as Some).0: T);
- _0 = _5;
+ _5 = _1;
+ _0 = _1;
StorageDead(_5);
StorageDead(_2);
return;
}

View File

@ -15,13 +15,15 @@
bb0: {
StorageLive(_2);
- StorageLive(_3);
- _3 = _1;
StorageLive(_3);
_3 = _1;
- _2 = Option::<T>::Some(move _3);
- StorageDead(_3);
+ _2 = Option::<T>::Some(_1);
_4 = discriminant(_2);
switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
StorageDead(_3);
- _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ _4 = const 1_isize;
+ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
}
bb1: {
@ -34,10 +36,12 @@
}
bb3: {
- StorageLive(_5);
_5 = ((_2 as Some).0: T);
_0 = _5;
- StorageDead(_5);
StorageLive(_5);
- _5 = ((_2 as Some).0: T);
- _0 = _5;
+ _5 = _1;
+ _0 = _1;
StorageDead(_5);
StorageDead(_2);
return;
}

View File

@ -7,22 +7,18 @@
let _2: &[T];
let mut _3: &[T; 3];
let _4: [T; 3];
let mut _5: T;
let mut _6: T;
let mut _7: T;
let mut _8: usize;
let mut _9: usize;
let mut _10: bool;
let mut _14: !;
let mut _5: usize;
let mut _6: bool;
let mut _10: !;
scope 1 {
debug v => _2;
let _11: &T;
let _12: &T;
let _13: &T;
let _7: &T;
let _8: &T;
let _9: &T;
scope 2 {
debug v1 => _11;
debug v2 => _12;
debug v3 => _13;
debug v1 => _7;
debug v2 => _8;
debug v3 => _9;
}
}
@ -33,26 +29,25 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
_8 = const 3_usize;
_9 = const 3_usize;
_10 = const true;
_5 = const 3_usize;
_6 = const true;
goto -> bb2;
}
bb1: {
_14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
_10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
}
bb2: {
StorageLive(_11);
_11 = &(*_2)[0 of 3];
StorageLive(_12);
_12 = &(*_2)[1 of 3];
StorageLive(_13);
_13 = &(*_2)[2 of 3];
StorageDead(_13);
StorageDead(_12);
StorageDead(_11);
StorageLive(_7);
_7 = &(*_2)[0 of 3];
StorageLive(_8);
_8 = &(*_2)[1 of 3];
StorageLive(_9);
_9 = &(*_2)[2 of 3];
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
StorageDead(_4);
return;
}

View File

@ -7,22 +7,18 @@
let _2: &[T];
let mut _3: &[T; 3];
let _4: [T; 3];
let mut _5: T;
let mut _6: T;
let mut _7: T;
let mut _8: usize;
let mut _9: usize;
let mut _10: bool;
let mut _14: !;
let mut _5: usize;
let mut _6: bool;
let mut _10: !;
scope 1 {
debug v => _2;
let _11: &T;
let _12: &T;
let _13: &T;
let _7: &T;
let _8: &T;
let _9: &T;
scope 2 {
debug v1 => _11;
debug v2 => _12;
debug v3 => _13;
debug v1 => _7;
debug v2 => _8;
debug v3 => _9;
}
}
@ -33,26 +29,25 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
_8 = const 3_usize;
_9 = const 3_usize;
_10 = const true;
_5 = const 3_usize;
_6 = const true;
goto -> bb2;
}
bb1: {
_14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
_10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
}
bb2: {
StorageLive(_11);
_11 = &(*_2)[0 of 3];
StorageLive(_12);
_12 = &(*_2)[1 of 3];
StorageLive(_13);
_13 = &(*_2)[2 of 3];
StorageDead(_13);
StorageDead(_12);
StorageDead(_11);
StorageLive(_7);
_7 = &(*_2)[0 of 3];
StorageLive(_8);
_8 = &(*_2)[1 of 3];
StorageLive(_9);
_9 = &(*_2)[2 of 3];
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
StorageDead(_4);
return;
}

View File

@ -3,18 +3,15 @@
fn main() -> () {
let mut _0: ();
let mut _1: bool;
let _2: ();
let _1: ();
bb0: {
StorageLive(_1);
_1 = const false;
- switchInt(const false) -> [0: bb3, otherwise: bb1];
+ goto -> bb3;
}
bb1: {
_2 = noop() -> [return: bb2, unwind unreachable];
_1 = noop() -> [return: bb2, unwind unreachable];
}
bb2: {
@ -26,7 +23,6 @@
}
bb4: {
StorageDead(_1);
return;
}
}

View File

@ -3,18 +3,15 @@
fn main() -> () {
let mut _0: ();
let mut _1: bool;
let _2: ();
let _1: ();
bb0: {
StorageLive(_1);
_1 = const false;
- switchInt(const false) -> [0: bb3, otherwise: bb1];
+ goto -> bb3;
}
bb1: {
_2 = noop() -> [return: bb2, unwind continue];
_1 = noop() -> [return: bb2, unwind continue];
}
bb2: {
@ -26,7 +23,6 @@
}
bb4: {
StorageDead(_1);
return;
}
}