Auto merge of #77876 - tmiasko:simplify-locals, r=wesleywiser
Remove unused set-discriminant statements and assignments regardless of rvalue * Represent use counts with u32 * Unify use count visitors * Change RemoveStatements visitor into a function * Remove unused set-discriminant statements * Use exhaustive match to clarify what is being optimized * Remove unused assignments regardless of rvalue kind
This commit is contained in:
commit
a4d30a7b49
22 changed files with 414 additions and 173 deletions
|
@ -35,6 +35,7 @@ use rustc_middle::mir::*;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
pub struct SimplifyCfg {
|
pub struct SimplifyCfg {
|
||||||
label: String,
|
label: String,
|
||||||
|
@ -322,32 +323,17 @@ impl<'tcx> MirPass<'tcx> for SimplifyLocals {
|
||||||
trace!("running SimplifyLocals on {:?}", body.source);
|
trace!("running SimplifyLocals on {:?}", body.source);
|
||||||
|
|
||||||
// First, we're going to get a count of *actual* uses for every `Local`.
|
// First, we're going to get a count of *actual* uses for every `Local`.
|
||||||
// Take a look at `DeclMarker::visit_local()` to see exactly what is ignored.
|
let mut used_locals = UsedLocals::new(body);
|
||||||
let mut used_locals = {
|
|
||||||
let mut marker = DeclMarker::new(body);
|
|
||||||
marker.visit_body(&body);
|
|
||||||
|
|
||||||
marker.local_counts
|
|
||||||
};
|
|
||||||
|
|
||||||
let arg_count = body.arg_count;
|
|
||||||
|
|
||||||
// Next, we're going to remove any `Local` with zero actual uses. When we remove those
|
// Next, we're going to remove any `Local` with zero actual uses. When we remove those
|
||||||
// `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals`
|
// `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals`
|
||||||
// count. For example, if we removed `_2 = discriminant(_1)`, then we'll subtract one from
|
// count. For example, if we removed `_2 = discriminant(_1)`, then we'll subtract one from
|
||||||
// `use_counts[_1]`. That in turn might make `_1` unused, so we loop until we hit a
|
// `use_counts[_1]`. That in turn might make `_1` unused, so we loop until we hit a
|
||||||
// fixedpoint where there are no more unused locals.
|
// fixedpoint where there are no more unused locals.
|
||||||
loop {
|
remove_unused_definitions(&mut used_locals, body);
|
||||||
let mut remove_statements = RemoveStatements::new(&mut used_locals, arg_count, tcx);
|
|
||||||
remove_statements.visit_body(body);
|
|
||||||
|
|
||||||
if !remove_statements.modified {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally, we'll actually do the work of shrinking `body.local_decls` and remapping the `Local`s.
|
// Finally, we'll actually do the work of shrinking `body.local_decls` and remapping the `Local`s.
|
||||||
let map = make_local_map(&mut body.local_decls, used_locals, arg_count);
|
let map = make_local_map(&mut body.local_decls, &used_locals);
|
||||||
|
|
||||||
// Only bother running the `LocalUpdater` if we actually found locals to remove.
|
// Only bother running the `LocalUpdater` if we actually found locals to remove.
|
||||||
if map.iter().any(Option::is_none) {
|
if map.iter().any(Option::is_none) {
|
||||||
|
@ -363,14 +349,14 @@ impl<'tcx> MirPass<'tcx> for SimplifyLocals {
|
||||||
/// Construct the mapping while swapping out unused stuff out from the `vec`.
|
/// Construct the mapping while swapping out unused stuff out from the `vec`.
|
||||||
fn make_local_map<V>(
|
fn make_local_map<V>(
|
||||||
local_decls: &mut IndexVec<Local, V>,
|
local_decls: &mut IndexVec<Local, V>,
|
||||||
used_locals: IndexVec<Local, usize>,
|
used_locals: &UsedLocals,
|
||||||
arg_count: usize,
|
|
||||||
) -> IndexVec<Local, Option<Local>> {
|
) -> IndexVec<Local, Option<Local>> {
|
||||||
let mut map: IndexVec<Local, Option<Local>> = IndexVec::from_elem(None, &*local_decls);
|
let mut map: IndexVec<Local, Option<Local>> = IndexVec::from_elem(None, &*local_decls);
|
||||||
let mut used = Local::new(0);
|
let mut used = Local::new(0);
|
||||||
for (alive_index, count) in used_locals.iter_enumerated() {
|
|
||||||
// The `RETURN_PLACE` and arguments are always live.
|
for alive_index in local_decls.indices() {
|
||||||
if alive_index.as_usize() > arg_count && *count == 0 {
|
// `is_used` treats the `RETURN_PLACE` and arguments as used.
|
||||||
|
if !used_locals.is_used(alive_index) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,149 +370,130 @@ fn make_local_map<V>(
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DeclMarker<'a, 'tcx> {
|
/// Keeps track of used & unused locals.
|
||||||
pub local_counts: IndexVec<Local, usize>,
|
struct UsedLocals {
|
||||||
pub body: &'a Body<'tcx>,
|
increment: bool,
|
||||||
|
arg_count: u32,
|
||||||
|
use_count: IndexVec<Local, u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> DeclMarker<'a, 'tcx> {
|
impl UsedLocals {
|
||||||
pub fn new(body: &'a Body<'tcx>) -> Self {
|
/// Determines which locals are used & unused in the given body.
|
||||||
Self { local_counts: IndexVec::from_elem(0, &body.local_decls), body }
|
fn new(body: &Body<'_>) -> Self {
|
||||||
|
let mut this = Self {
|
||||||
|
increment: true,
|
||||||
|
arg_count: body.arg_count.try_into().unwrap(),
|
||||||
|
use_count: IndexVec::from_elem(0, &body.local_decls),
|
||||||
|
};
|
||||||
|
this.visit_body(body);
|
||||||
|
this
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks if local is used.
|
||||||
|
///
|
||||||
|
/// Return place and arguments are always considered used.
|
||||||
|
fn is_used(&self, local: Local) -> bool {
|
||||||
|
trace!("is_used({:?}): use_count: {:?}", local, self.use_count[local]);
|
||||||
|
local.as_u32() <= self.arg_count || self.use_count[local] != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the use counts to reflect the removal of given statement.
|
||||||
|
fn statement_removed(&mut self, statement: &Statement<'tcx>) {
|
||||||
|
self.increment = false;
|
||||||
|
|
||||||
|
// The location of the statement is irrelevant.
|
||||||
|
let location = Location { block: START_BLOCK, statement_index: 0 };
|
||||||
|
self.visit_statement(statement, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Visits a left-hand side of an assignment.
|
||||||
|
fn visit_lhs(&mut self, place: &Place<'tcx>, location: Location) {
|
||||||
|
if place.is_indirect() {
|
||||||
|
// A use, not a definition.
|
||||||
|
self.visit_place(place, PlaceContext::MutatingUse(MutatingUseContext::Store), location);
|
||||||
|
} else {
|
||||||
|
// A definition. Although, it still might use other locals for indexing.
|
||||||
|
self.super_projection(
|
||||||
|
place.local,
|
||||||
|
&place.projection,
|
||||||
|
PlaceContext::MutatingUse(MutatingUseContext::Projection),
|
||||||
|
location,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Visitor<'tcx> for DeclMarker<'a, 'tcx> {
|
impl Visitor<'_> for UsedLocals {
|
||||||
fn visit_local(&mut self, local: &Local, ctx: PlaceContext, location: Location) {
|
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
||||||
// Ignore storage markers altogether, they get removed along with their otherwise unused
|
match statement.kind {
|
||||||
// decls.
|
StatementKind::LlvmInlineAsm(..)
|
||||||
// FIXME: Extend this to all non-uses.
|
| StatementKind::Retag(..)
|
||||||
if ctx.is_storage_marker() {
|
| StatementKind::Coverage(..)
|
||||||
return;
|
| StatementKind::FakeRead(..)
|
||||||
|
| StatementKind::AscribeUserType(..) => {
|
||||||
|
self.super_statement(statement, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
StatementKind::Nop => {}
|
||||||
|
|
||||||
|
StatementKind::StorageLive(_local) | StatementKind::StorageDead(_local) => {}
|
||||||
|
|
||||||
|
StatementKind::Assign(box (ref place, ref rvalue)) => {
|
||||||
|
self.visit_lhs(place, location);
|
||||||
|
self.visit_rvalue(rvalue, location);
|
||||||
|
}
|
||||||
|
|
||||||
|
StatementKind::SetDiscriminant { ref place, variant_index: _ } => {
|
||||||
|
self.visit_lhs(place, location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore stores of constants because `ConstProp` and `CopyProp` can remove uses of many
|
fn visit_local(&mut self, local: &Local, _ctx: PlaceContext, _location: Location) {
|
||||||
// of these locals. However, if the local is still needed, then it will be referenced in
|
if self.increment {
|
||||||
// another place and we'll mark it as being used there.
|
self.use_count[*local] += 1;
|
||||||
if ctx == PlaceContext::MutatingUse(MutatingUseContext::Store)
|
} else {
|
||||||
|| ctx == PlaceContext::MutatingUse(MutatingUseContext::Projection)
|
assert_ne!(self.use_count[*local], 0);
|
||||||
{
|
self.use_count[*local] -= 1;
|
||||||
let block = &self.body.basic_blocks()[location.block];
|
}
|
||||||
if location.statement_index != block.statements.len() {
|
}
|
||||||
let stmt = &block.statements[location.statement_index];
|
}
|
||||||
|
|
||||||
if let StatementKind::Assign(box (dest, rvalue)) = &stmt.kind {
|
/// Removes unused definitions. Updates the used locals to reflect the changes made.
|
||||||
if !dest.is_indirect() && dest.local == *local {
|
fn remove_unused_definitions<'a, 'tcx>(used_locals: &'a mut UsedLocals, body: &mut Body<'tcx>) {
|
||||||
let can_skip = match rvalue {
|
// The use counts are updated as we remove the statements. A local might become unused
|
||||||
Rvalue::Use(_)
|
// during the retain operation, leading to a temporary inconsistency (storage statements or
|
||||||
| Rvalue::Discriminant(_)
|
// definitions referencing the local might remain). For correctness it is crucial that this
|
||||||
| Rvalue::BinaryOp(_, _, _)
|
// computation reaches a fixed point.
|
||||||
| Rvalue::CheckedBinaryOp(_, _, _)
|
|
||||||
| Rvalue::Repeat(_, _)
|
|
||||||
| Rvalue::AddressOf(_, _)
|
|
||||||
| Rvalue::Len(_)
|
|
||||||
| Rvalue::UnaryOp(_, _)
|
|
||||||
| Rvalue::Aggregate(_, _) => true,
|
|
||||||
|
|
||||||
_ => false,
|
let mut modified = true;
|
||||||
};
|
while modified {
|
||||||
|
modified = false;
|
||||||
|
|
||||||
if can_skip {
|
for data in body.basic_blocks_mut() {
|
||||||
trace!("skipping store of {:?} to {:?}", rvalue, dest);
|
// Remove unnecessary StorageLive and StorageDead annotations.
|
||||||
return;
|
data.statements.retain(|statement| {
|
||||||
}
|
let keep = match &statement.kind {
|
||||||
|
StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
|
||||||
|
used_locals.is_used(*local)
|
||||||
}
|
}
|
||||||
|
StatementKind::Assign(box (place, _)) => used_locals.is_used(place.local),
|
||||||
|
|
||||||
|
StatementKind::SetDiscriminant { ref place, .. } => {
|
||||||
|
used_locals.is_used(place.local)
|
||||||
|
}
|
||||||
|
_ => true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if !keep {
|
||||||
|
trace!("removing statement {:?}", statement);
|
||||||
|
modified = true;
|
||||||
|
used_locals.statement_removed(statement);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
keep
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.local_counts[*local] += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct StatementDeclMarker<'a, 'tcx> {
|
|
||||||
used_locals: &'a mut IndexVec<Local, usize>,
|
|
||||||
statement: &'a Statement<'tcx>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> StatementDeclMarker<'a, 'tcx> {
|
|
||||||
pub fn new(
|
|
||||||
used_locals: &'a mut IndexVec<Local, usize>,
|
|
||||||
statement: &'a Statement<'tcx>,
|
|
||||||
) -> Self {
|
|
||||||
Self { used_locals, statement }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> Visitor<'tcx> for StatementDeclMarker<'a, 'tcx> {
|
|
||||||
fn visit_local(&mut self, local: &Local, context: PlaceContext, _location: Location) {
|
|
||||||
// Skip the lvalue for assignments
|
|
||||||
if let StatementKind::Assign(box (p, _)) = self.statement.kind {
|
|
||||||
if p.local == *local && context.is_place_assignment() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let use_count = &mut self.used_locals[*local];
|
|
||||||
// If this is the local we're removing...
|
|
||||||
if *use_count != 0 {
|
|
||||||
*use_count -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct RemoveStatements<'a, 'tcx> {
|
|
||||||
used_locals: &'a mut IndexVec<Local, usize>,
|
|
||||||
arg_count: usize,
|
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
modified: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> RemoveStatements<'a, 'tcx> {
|
|
||||||
fn new(
|
|
||||||
used_locals: &'a mut IndexVec<Local, usize>,
|
|
||||||
arg_count: usize,
|
|
||||||
tcx: TyCtxt<'tcx>,
|
|
||||||
) -> Self {
|
|
||||||
Self { used_locals, arg_count, tcx, modified: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn keep_local(&self, l: Local) -> bool {
|
|
||||||
trace!("keep_local({:?}): count: {:?}", l, self.used_locals[l]);
|
|
||||||
l.as_usize() <= self.arg_count || self.used_locals[l] != 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'tcx> MutVisitor<'tcx> for RemoveStatements<'a, 'tcx> {
|
|
||||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
|
||||||
self.tcx
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_basic_block_data(&mut self, block: BasicBlock, data: &mut BasicBlockData<'tcx>) {
|
|
||||||
// Remove unnecessary StorageLive and StorageDead annotations.
|
|
||||||
let mut i = 0usize;
|
|
||||||
data.statements.retain(|stmt| {
|
|
||||||
let keep = match &stmt.kind {
|
|
||||||
StatementKind::StorageLive(l) | StatementKind::StorageDead(l) => {
|
|
||||||
self.keep_local(*l)
|
|
||||||
}
|
|
||||||
StatementKind::Assign(box (place, _)) => self.keep_local(place.local),
|
|
||||||
_ => true,
|
|
||||||
};
|
|
||||||
|
|
||||||
if !keep {
|
|
||||||
trace!("removing statement {:?}", stmt);
|
|
||||||
self.modified = true;
|
|
||||||
|
|
||||||
let mut visitor = StatementDeclMarker::new(self.used_locals, stmt);
|
|
||||||
visitor.visit_statement(stmt, Location { block, statement_index: i });
|
|
||||||
}
|
|
||||||
|
|
||||||
i += 1;
|
|
||||||
|
|
||||||
keep
|
|
||||||
});
|
|
||||||
|
|
||||||
self.super_basic_block_data(block, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
// compile-flags:-Zprint-mono-items=eager
|
// compile-flags:-Zprint-mono-items=eager -Zinline-in-all-cgus -Zmir-opt-level=0
|
||||||
// compile-flags:-Zinline-in-all-cgus
|
|
||||||
|
|
||||||
#![deny(dead_code)]
|
#![deny(dead_code)]
|
||||||
#![feature(start)]
|
#![feature(start)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -O -C no-prepopulate-passes
|
// compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ pub fn test() {
|
||||||
// CHECK: [[S_b:%[0-9]+]] = bitcast { i32, i32 }** %b to i8*
|
// CHECK: [[S_b:%[0-9]+]] = bitcast { i32, i32 }** %b to i8*
|
||||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S_b]])
|
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S_b]])
|
||||||
|
|
||||||
// CHECK: [[S__4:%[0-9]+]] = bitcast { i32, i32 }* %_4 to i8*
|
// CHECK: [[S__4:%[0-9]+]] = bitcast { i32, i32 }* %_5 to i8*
|
||||||
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S__4]])
|
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S__4]])
|
||||||
|
|
||||||
// CHECK: [[E__4:%[0-9]+]] = bitcast { i32, i32 }* %_4 to i8*
|
// CHECK: [[E__4:%[0-9]+]] = bitcast { i32, i32 }* %_5 to i8*
|
||||||
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, i8* [[E__4]])
|
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, i8* [[E__4]])
|
||||||
|
|
||||||
// CHECK: [[E_b:%[0-9]+]] = bitcast { i32, i32 }** %b to i8*
|
// CHECK: [[E_b:%[0-9]+]] = bitcast { i32, i32 }** %b to i8*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -C no-prepopulate-passes
|
// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -C no-prepopulate-passes
|
// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(naked_functions)]
|
#![feature(naked_functions)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -C no-prepopulate-passes
|
// compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
// build-pass (FIXME(62277): could be check-pass?)
|
// build-pass (FIXME(62277): could be check-pass?)
|
||||||
// revisions: cfail1 cfail2 cfail3
|
// revisions: cfail1 cfail2 cfail3
|
||||||
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
|
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans -Zmir-opt-level=0
|
||||||
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
@ -53,7 +53,7 @@ pub fn change_parameter_pattern() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(cfail1))]
|
#[cfg(not(cfail1))]
|
||||||
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")]
|
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck, optimized_mir")]
|
||||||
#[rustc_clean(cfg="cfail3")]
|
#[rustc_clean(cfg="cfail3")]
|
||||||
pub fn change_parameter_pattern() {
|
pub fn change_parameter_pattern() {
|
||||||
let _ = |(x,): (u32,)| x;
|
let _ = |(x,): (u32,)| x;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
// build-pass (FIXME(62277): could be check-pass?)
|
// build-pass (FIXME(62277): could be check-pass?)
|
||||||
// revisions: cfail1 cfail2 cfail3
|
// revisions: cfail1 cfail2 cfail3
|
||||||
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans
|
// compile-flags: -Z query-dep-graph -Zincremental-ignore-spans -Zmir-opt-level=0
|
||||||
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
74
src/test/mir-opt/simplify-locals.rs
Normal file
74
src/test/mir-opt/simplify-locals.rs
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
// compile-flags: -C overflow-checks=off
|
||||||
|
|
||||||
|
#![feature(box_syntax)]
|
||||||
|
#![feature(thread_local)]
|
||||||
|
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
enum E {
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.c.SimplifyLocals.diff
|
||||||
|
fn c() {
|
||||||
|
let bytes = [0u8; 10];
|
||||||
|
// Unused cast
|
||||||
|
let _: &[u8] = &bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.d1.SimplifyLocals.diff
|
||||||
|
fn d1() {
|
||||||
|
// Unused set discriminant
|
||||||
|
let _ = E::A;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.d2.SimplifyLocals.diff
|
||||||
|
fn d2() {
|
||||||
|
// Unused set discriminant
|
||||||
|
{(10, E::A)}.1 = E::B;
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.r.SimplifyLocals.diff
|
||||||
|
fn r() {
|
||||||
|
let mut a = 1;
|
||||||
|
// Unused references
|
||||||
|
let _ = &a;
|
||||||
|
let _ = &mut a;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[thread_local] static mut X: u32 = 0;
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.t1.SimplifyLocals.diff
|
||||||
|
fn t1() {
|
||||||
|
// Unused thread local
|
||||||
|
unsafe { X };
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.t2.SimplifyLocals.diff
|
||||||
|
fn t2() {
|
||||||
|
// Unused thread local
|
||||||
|
unsafe { &mut X };
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.t3.SimplifyLocals.diff
|
||||||
|
fn t3() {
|
||||||
|
// Unused thread local
|
||||||
|
unsafe { *&mut X };
|
||||||
|
}
|
||||||
|
|
||||||
|
// EMIT_MIR simplify_locals.t4.SimplifyLocals.diff
|
||||||
|
fn t4() -> u32 {
|
||||||
|
// Used thread local
|
||||||
|
unsafe { X + 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
c();
|
||||||
|
d1();
|
||||||
|
d2();
|
||||||
|
r();
|
||||||
|
t1();
|
||||||
|
t2();
|
||||||
|
t3();
|
||||||
|
t4();
|
||||||
|
}
|
28
src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff
Normal file
28
src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
- // MIR for `c` before SimplifyLocals
|
||||||
|
+ // MIR for `c` after SimplifyLocals
|
||||||
|
|
||||||
|
fn c() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:13:8: 13:8
|
||||||
|
let _1: [u8; 10]; // in scope 0 at $DIR/simplify-locals.rs:14:9: 14:14
|
||||||
|
- let mut _2: &[u8]; // in scope 0 at $DIR/simplify-locals.rs:16:20: 16:26
|
||||||
|
- let mut _3: &[u8; 10]; // in scope 0 at $DIR/simplify-locals.rs:16:20: 16:26
|
||||||
|
- let _4: &[u8; 10]; // in scope 0 at $DIR/simplify-locals.rs:16:20: 16:26
|
||||||
|
scope 1 {
|
||||||
|
debug bytes => _1; // in scope 1 at $DIR/simplify-locals.rs:14:9: 14:14
|
||||||
|
scope 2 {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:14:9: 14:14
|
||||||
|
_1 = [const 0_u8; 10]; // scope 0 at $DIR/simplify-locals.rs:14:17: 14:26
|
||||||
|
- StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26
|
||||||
|
- _3 = &_1; // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26
|
||||||
|
- _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26
|
||||||
|
- StorageDead(_2); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:13:8: 17:2
|
||||||
|
StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:17:1: 17:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:17:2: 17:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff
Normal file
18
src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
- // MIR for `d1` before SimplifyLocals
|
||||||
|
+ // MIR for `d1` after SimplifyLocals
|
||||||
|
|
||||||
|
fn d1() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:20:9: 20:9
|
||||||
|
- let mut _1: E; // in scope 0 at $DIR/simplify-locals.rs:22:13: 22:17
|
||||||
|
scope 1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
- StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:22:13: 22:17
|
||||||
|
- discriminant(_1) = 0; // scope 0 at $DIR/simplify-locals.rs:22:13: 22:17
|
||||||
|
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:22:17: 22:18
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:20:9: 23:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:23:2: 23:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
38
src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff
Normal file
38
src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
- // MIR for `d2` before SimplifyLocals
|
||||||
|
+ // MIR for `d2` after SimplifyLocals
|
||||||
|
|
||||||
|
fn d2() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:26:9: 26:9
|
||||||
|
- let mut _1: E; // in scope 0 at $DIR/simplify-locals.rs:28:22: 28:26
|
||||||
|
- let mut _2: (i32, E); // in scope 0 at $DIR/simplify-locals.rs:28:5: 28:17
|
||||||
|
- let mut _3: E; // in scope 0 at $DIR/simplify-locals.rs:28:11: 28:15
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
- StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:28:22: 28:26
|
||||||
|
- discriminant(_1) = 1; // scope 0 at $DIR/simplify-locals.rs:28:22: 28:26
|
||||||
|
- StorageLive(_2); // scope 0 at $DIR/simplify-locals.rs:28:5: 28:17
|
||||||
|
- StorageLive(_3); // scope 0 at $DIR/simplify-locals.rs:28:11: 28:15
|
||||||
|
- discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals.rs:28:11: 28:15
|
||||||
|
- (_2.0: i32) = const 10_i32; // scope 0 at $DIR/simplify-locals.rs:28:6: 28:16
|
||||||
|
- (_2.1: E) = const E::A; // scope 0 at $DIR/simplify-locals.rs:28:6: 28:16
|
||||||
|
- // ty::Const
|
||||||
|
- // + ty: E
|
||||||
|
- // + val: Value(Scalar(0x00))
|
||||||
|
- // mir::Constant
|
||||||
|
- // + span: $DIR/simplify-locals.rs:28:6: 28:16
|
||||||
|
- // + literal: Const { ty: E, val: Value(Scalar(0x00)) }
|
||||||
|
- StorageDead(_3); // scope 0 at $DIR/simplify-locals.rs:28:15: 28:16
|
||||||
|
- (_2.1: E) = const E::B; // scope 0 at $DIR/simplify-locals.rs:28:5: 28:26
|
||||||
|
- // ty::Const
|
||||||
|
- // + ty: E
|
||||||
|
- // + val: Value(Scalar(0x01))
|
||||||
|
- // mir::Constant
|
||||||
|
- // + span: $DIR/simplify-locals.rs:28:5: 28:26
|
||||||
|
- // + literal: Const { ty: E, val: Value(Scalar(0x01)) }
|
||||||
|
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:28:25: 28:26
|
||||||
|
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:28:26: 28:27
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:26:9: 29:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:29:2: 29:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
31
src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff
Normal file
31
src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
- // MIR for `r` before SimplifyLocals
|
||||||
|
+ // MIR for `r` after SimplifyLocals
|
||||||
|
|
||||||
|
fn r() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:32:8: 32:8
|
||||||
|
let mut _1: i32; // in scope 0 at $DIR/simplify-locals.rs:33:9: 33:14
|
||||||
|
- let mut _2: &i32; // in scope 0 at $DIR/simplify-locals.rs:35:13: 35:15
|
||||||
|
- let mut _3: &mut i32; // in scope 0 at $DIR/simplify-locals.rs:36:13: 36:19
|
||||||
|
scope 1 {
|
||||||
|
debug a => _1; // in scope 1 at $DIR/simplify-locals.rs:33:9: 33:14
|
||||||
|
scope 2 {
|
||||||
|
scope 3 {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:33:9: 33:14
|
||||||
|
_1 = const 1_i32; // scope 0 at $DIR/simplify-locals.rs:33:17: 33:18
|
||||||
|
- StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:35:13: 35:15
|
||||||
|
- _2 = &_1; // scope 1 at $DIR/simplify-locals.rs:35:13: 35:15
|
||||||
|
- StorageDead(_2); // scope 1 at $DIR/simplify-locals.rs:35:15: 35:16
|
||||||
|
- StorageLive(_3); // scope 2 at $DIR/simplify-locals.rs:36:13: 36:19
|
||||||
|
- _3 = &mut _1; // scope 2 at $DIR/simplify-locals.rs:36:13: 36:19
|
||||||
|
- StorageDead(_3); // scope 2 at $DIR/simplify-locals.rs:36:19: 36:20
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:32:8: 37:2
|
||||||
|
StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:37:1: 37:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:37:2: 37:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
22
src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff
Normal file
22
src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
- // MIR for `t1` before SimplifyLocals
|
||||||
|
+ // MIR for `t1` after SimplifyLocals
|
||||||
|
|
||||||
|
fn t1() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:42:9: 42:9
|
||||||
|
- let _1: u32; // in scope 0 at $DIR/simplify-locals.rs:44:14: 44:15
|
||||||
|
- let mut _2: *mut u32; // in scope 0 at $DIR/simplify-locals.rs:44:14: 44:15
|
||||||
|
scope 1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
- StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:44:5: 44:17
|
||||||
|
- StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:44:14: 44:15
|
||||||
|
- _2 = &/*tls*/ mut X; // scope 1 at $DIR/simplify-locals.rs:44:14: 44:15
|
||||||
|
- _1 = (*_2); // scope 1 at $DIR/simplify-locals.rs:44:14: 44:15
|
||||||
|
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:44:17: 44:18
|
||||||
|
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:44:17: 44:18
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:42:9: 45:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:45:2: 45:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
22
src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff
Normal file
22
src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
- // MIR for `t2` before SimplifyLocals
|
||||||
|
+ // MIR for `t2` after SimplifyLocals
|
||||||
|
|
||||||
|
fn t2() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:48:9: 48:9
|
||||||
|
- let _1: &mut u32; // in scope 0 at $DIR/simplify-locals.rs:50:14: 50:20
|
||||||
|
- let mut _2: *mut u32; // in scope 0 at $DIR/simplify-locals.rs:50:19: 50:20
|
||||||
|
scope 1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
- StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:50:5: 50:22
|
||||||
|
- StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:50:19: 50:20
|
||||||
|
- _2 = &/*tls*/ mut X; // scope 1 at $DIR/simplify-locals.rs:50:19: 50:20
|
||||||
|
- _1 = &mut (*_2); // scope 1 at $DIR/simplify-locals.rs:50:14: 50:20
|
||||||
|
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:50:22: 50:23
|
||||||
|
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:50:22: 50:23
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:48:9: 51:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:51:2: 51:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
26
src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff
Normal file
26
src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
- // MIR for `t3` before SimplifyLocals
|
||||||
|
+ // MIR for `t3` after SimplifyLocals
|
||||||
|
|
||||||
|
fn t3() -> () {
|
||||||
|
let mut _0: (); // return place in scope 0 at $DIR/simplify-locals.rs:54:9: 54:9
|
||||||
|
- let _1: u32; // in scope 0 at $DIR/simplify-locals.rs:56:14: 56:21
|
||||||
|
- let mut _2: &mut u32; // in scope 0 at $DIR/simplify-locals.rs:56:15: 56:21
|
||||||
|
- let mut _3: *mut u32; // in scope 0 at $DIR/simplify-locals.rs:56:20: 56:21
|
||||||
|
scope 1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
- StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:56:5: 56:23
|
||||||
|
- StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:56:15: 56:21
|
||||||
|
- StorageLive(_3); // scope 1 at $DIR/simplify-locals.rs:56:20: 56:21
|
||||||
|
- _3 = &/*tls*/ mut X; // scope 1 at $DIR/simplify-locals.rs:56:20: 56:21
|
||||||
|
- _2 = &mut (*_3); // scope 1 at $DIR/simplify-locals.rs:56:15: 56:21
|
||||||
|
- _1 = (*_2); // scope 1 at $DIR/simplify-locals.rs:56:14: 56:21
|
||||||
|
- StorageDead(_3); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24
|
||||||
|
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24
|
||||||
|
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24
|
||||||
|
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:54:9: 57:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:57:2: 57:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
22
src/test/mir-opt/simplify_locals.t4.SimplifyLocals.diff
Normal file
22
src/test/mir-opt/simplify_locals.t4.SimplifyLocals.diff
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
- // MIR for `t4` before SimplifyLocals
|
||||||
|
+ // MIR for `t4` after SimplifyLocals
|
||||||
|
|
||||||
|
fn t4() -> u32 {
|
||||||
|
let mut _0: u32; // return place in scope 0 at $DIR/simplify-locals.rs:60:12: 60:15
|
||||||
|
let mut _1: u32; // in scope 0 at $DIR/simplify-locals.rs:62:14: 62:15
|
||||||
|
let mut _2: *mut u32; // in scope 0 at $DIR/simplify-locals.rs:62:14: 62:15
|
||||||
|
scope 1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
bb0: {
|
||||||
|
StorageLive(_1); // scope 1 at $DIR/simplify-locals.rs:62:14: 62:15
|
||||||
|
StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:62:14: 62:15
|
||||||
|
_2 = &/*tls*/ mut X; // scope 1 at $DIR/simplify-locals.rs:62:14: 62:15
|
||||||
|
_1 = (*_2); // scope 1 at $DIR/simplify-locals.rs:62:14: 62:15
|
||||||
|
_0 = Add(move _1, const 1_u32); // scope 1 at $DIR/simplify-locals.rs:62:14: 62:19
|
||||||
|
StorageDead(_1); // scope 1 at $DIR/simplify-locals.rs:62:18: 62:19
|
||||||
|
StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:63:1: 63:2
|
||||||
|
return; // scope 0 at $DIR/simplify-locals.rs:63:2: 63:2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
fn change_loop_body() -> () {
|
fn change_loop_body() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
|
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
|
||||||
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
||||||
let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/while_let_loops.rs:7:28: 7:32
|
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
|
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
|
||||||
}
|
}
|
||||||
|
@ -11,10 +10,7 @@ fn change_loop_body() -> () {
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
||||||
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
|
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
|
||||||
StorageLive(_2); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32
|
|
||||||
discriminant(_2) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32
|
|
||||||
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
|
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
|
||||||
StorageDead(_2); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6
|
|
||||||
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
|
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
|
||||||
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
|
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
fn change_loop_body() -> () {
|
fn change_loop_body() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
|
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27
|
||||||
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
||||||
let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/while_let_loops.rs:7:28: 7:32
|
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
|
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15
|
||||||
}
|
}
|
||||||
|
@ -11,10 +10,7 @@ fn change_loop_body() -> () {
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15
|
||||||
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
|
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19
|
||||||
StorageLive(_2); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32
|
|
||||||
discriminant(_2) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32
|
|
||||||
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
|
_0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6
|
||||||
StorageDead(_2); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6
|
|
||||||
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
|
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2
|
||||||
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
|
return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
// compile-flags: -Zmir-opt-level=0
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
Bug::V([0; !0]); //~ ERROR is too big for the current
|
Bug::V([0; !0]); //~ ERROR is too big for the current
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: the type `[u8; 18446744073709551615]` is too big for the current architecture
|
error: the type `[u8; 18446744073709551615]` is too big for the current architecture
|
||||||
--> $DIR/issue-69485-var-size-diffs-too-large.rs:5:12
|
--> $DIR/issue-69485-var-size-diffs-too-large.rs:6:12
|
||||||
|
|
|
|
||||||
LL | Bug::V([0; !0]);
|
LL | Bug::V([0; !0]);
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
// build-fail
|
// build-fail
|
||||||
// normalize-stderr-test: ".nll/" -> "/"
|
// normalize-stderr-test: ".nll/" -> "/"
|
||||||
|
// compile-flags: -Zmir-opt-level=0
|
||||||
|
|
||||||
struct S<T> {
|
struct S<T> {
|
||||||
t: T,
|
t: T,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue