Auto merge of #112418 - ferrocene:pa-mir-opt-panic, r=ozkanonur,saethlin
Add support for targets without unwinding in `mir-opt`, and improve `--bless` for it The main goal of this PR is to add support for targets without unwinding support in the `mir-opt` test suite, by adding the `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment. Similarly to 32bit vs 64bit, when that comment is present, blessed output files will have the `.panic-unwind` or `.panic-abort` suffix, and the right one will be chosen depending on the target's panic strategy. The `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment replaced all the `ignore-wasm32` comments in the `mir-opt` test suite, as those comments were added due to `wasm32` being a target without unwinding support. The comment was also added on other tests that were only executed on x86 but were still panic strategy dependent. The `mir-opt` suite was then blessed, which caused a ton of churn as most of the existing output files had to be renamed and (mostly) duplicated with the abort strategy. --- After [asking on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mir-opt.20tests.20and.20panic.3Dabort), the main concern about this change is it'd make blessing the `mir-opt` suite even harder, as you'd need to both bless it with an unwinding target and an aborting target. This exacerbated the current situation, where you'd need to bless it with a 32bit and a 64bit target already. Because of that, this PR also makes significant enhancements to `--bless` for the `mir-opt` suite, where it will automatically bless the suite four times with different targets, while requiring minimal cross-compilation. To handle the 32bit vs 64bit blessing, there is now an hardcoded list of target mapping between 32bit and 64bit. The goal of the list is to find a related target that will *probably* work without requiring additional cross-compilation toolchains on the system. If a mapping is found, bootstrap will bless the suite with both targets, otherwise just with the current target. To handle the panic strategy blessing (abort vs unwind), I had to resort to what I call "synthetic targets". For each of the target we're blessing (so either the current one, or a 32bit and a 64bit depending on the previous paragraph), bootstrap will extract the JSON spec of the target and change it to include `"panic-strategy": "abort"`. It will then build the standard library with this synthetic target, and bless the `mir-opt` suite with it. As a result of these changes, blessing the `mir-opt` suite will actually bless it two or four times with different targets, ensuring all possible variants are actually blessed. --- This PR is best reviewed commit-by-commit. r? `@jyn514` cc `@saethlin` `@oli-obk`
This commit is contained in:
commit
afa9fef709
518 changed files with 11695 additions and 253 deletions
|
|
@ -36,6 +36,8 @@ fn main() {
|
|||
|| target.contains("nintendo-3ds")
|
||||
|| target.contains("vita")
|
||||
|| target.contains("nto")
|
||||
// See src/bootstrap/synthetic_targets.rs
|
||||
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
|
||||
{
|
||||
// These platforms don't have any special requirements.
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1650,7 +1650,8 @@ impl<'a> Builder<'a> {
|
|||
}
|
||||
};
|
||||
cargo.env(profile_var("DEBUG"), debuginfo_level.to_string());
|
||||
if self.cc[&target].args().iter().any(|arg| arg == "-gz") {
|
||||
if !self.config.dry_run() && self.cc.borrow()[&target].args().iter().any(|arg| arg == "-gz")
|
||||
{
|
||||
rustflags.arg("-Clink-arg=-gz");
|
||||
}
|
||||
cargo.env(
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
|
|||
cfg
|
||||
}
|
||||
|
||||
pub fn find(build: &mut Build) {
|
||||
pub fn find(build: &Build) {
|
||||
// For all targets we're going to need a C compiler for building some shims
|
||||
// and such as well as for being a linker for Rust code.
|
||||
let targets = build
|
||||
|
|
@ -100,60 +100,64 @@ pub fn find(build: &mut Build) {
|
|||
.chain(iter::once(build.build))
|
||||
.collect::<HashSet<_>>();
|
||||
for target in targets.into_iter() {
|
||||
let mut cfg = new_cc_build(build, target);
|
||||
let config = build.config.target_config.get(&target);
|
||||
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
|
||||
cfg.compiler(cc);
|
||||
} else {
|
||||
set_compiler(&mut cfg, Language::C, target, config, build);
|
||||
}
|
||||
find_target(build, target);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_target(build: &Build, target: TargetSelection) {
|
||||
let mut cfg = new_cc_build(build, target);
|
||||
let config = build.config.target_config.get(&target);
|
||||
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
|
||||
cfg.compiler(cc);
|
||||
} else {
|
||||
set_compiler(&mut cfg, Language::C, target, config, build);
|
||||
}
|
||||
|
||||
let compiler = cfg.get_compiler();
|
||||
let ar = if let ar @ Some(..) = config.and_then(|c| c.ar.clone()) {
|
||||
ar
|
||||
} else {
|
||||
cc2ar(compiler.path(), target)
|
||||
};
|
||||
|
||||
build.cc.borrow_mut().insert(target, compiler.clone());
|
||||
let cflags = build.cflags(target, GitRepo::Rustc, CLang::C);
|
||||
|
||||
// If we use llvm-libunwind, we will need a C++ compiler as well for all targets
|
||||
// We'll need one anyways if the target triple is also a host triple
|
||||
let mut cfg = new_cc_build(build, target);
|
||||
cfg.cpp(true);
|
||||
let cxx_configured = if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
|
||||
cfg.compiler(cxx);
|
||||
true
|
||||
} else if build.hosts.contains(&target) || build.build == target {
|
||||
set_compiler(&mut cfg, Language::CPlusPlus, target, config, build);
|
||||
true
|
||||
} else {
|
||||
// Use an auto-detected compiler (or one configured via `CXX_target_triple` env vars).
|
||||
cfg.try_get_compiler().is_ok()
|
||||
};
|
||||
|
||||
// for VxWorks, record CXX compiler which will be used in lib.rs:linker()
|
||||
if cxx_configured || target.contains("vxworks") {
|
||||
let compiler = cfg.get_compiler();
|
||||
let ar = if let ar @ Some(..) = config.and_then(|c| c.ar.clone()) {
|
||||
ar
|
||||
} else {
|
||||
cc2ar(compiler.path(), target)
|
||||
};
|
||||
build.cxx.borrow_mut().insert(target, compiler);
|
||||
}
|
||||
|
||||
build.cc.insert(target, compiler.clone());
|
||||
let cflags = build.cflags(target, GitRepo::Rustc, CLang::C);
|
||||
build.verbose(&format!("CC_{} = {:?}", &target.triple, build.cc(target)));
|
||||
build.verbose(&format!("CFLAGS_{} = {:?}", &target.triple, cflags));
|
||||
if let Ok(cxx) = build.cxx(target) {
|
||||
let cxxflags = build.cflags(target, GitRepo::Rustc, CLang::Cxx);
|
||||
build.verbose(&format!("CXX_{} = {:?}", &target.triple, cxx));
|
||||
build.verbose(&format!("CXXFLAGS_{} = {:?}", &target.triple, cxxflags));
|
||||
}
|
||||
if let Some(ar) = ar {
|
||||
build.verbose(&format!("AR_{} = {:?}", &target.triple, ar));
|
||||
build.ar.borrow_mut().insert(target, ar);
|
||||
}
|
||||
|
||||
// If we use llvm-libunwind, we will need a C++ compiler as well for all targets
|
||||
// We'll need one anyways if the target triple is also a host triple
|
||||
let mut cfg = new_cc_build(build, target);
|
||||
cfg.cpp(true);
|
||||
let cxx_configured = if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
|
||||
cfg.compiler(cxx);
|
||||
true
|
||||
} else if build.hosts.contains(&target) || build.build == target {
|
||||
set_compiler(&mut cfg, Language::CPlusPlus, target, config, build);
|
||||
true
|
||||
} else {
|
||||
// Use an auto-detected compiler (or one configured via `CXX_target_triple` env vars).
|
||||
cfg.try_get_compiler().is_ok()
|
||||
};
|
||||
|
||||
// for VxWorks, record CXX compiler which will be used in lib.rs:linker()
|
||||
if cxx_configured || target.contains("vxworks") {
|
||||
let compiler = cfg.get_compiler();
|
||||
build.cxx.insert(target, compiler);
|
||||
}
|
||||
|
||||
build.verbose(&format!("CC_{} = {:?}", &target.triple, build.cc(target)));
|
||||
build.verbose(&format!("CFLAGS_{} = {:?}", &target.triple, cflags));
|
||||
if let Ok(cxx) = build.cxx(target) {
|
||||
let cxxflags = build.cflags(target, GitRepo::Rustc, CLang::Cxx);
|
||||
build.verbose(&format!("CXX_{} = {:?}", &target.triple, cxx));
|
||||
build.verbose(&format!("CXXFLAGS_{} = {:?}", &target.triple, cxxflags));
|
||||
}
|
||||
if let Some(ar) = ar {
|
||||
build.verbose(&format!("AR_{} = {:?}", &target.triple, ar));
|
||||
build.ar.insert(target, ar);
|
||||
}
|
||||
|
||||
if let Some(ranlib) = config.and_then(|c| c.ranlib.clone()) {
|
||||
build.ranlib.insert(target, ranlib);
|
||||
}
|
||||
if let Some(ranlib) = config.and_then(|c| c.ranlib.clone()) {
|
||||
build.ranlib.borrow_mut().insert(target, ranlib);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,11 @@ impl Step for Std {
|
|||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
// See src/bootstrap/synthetic_targets.rs
|
||||
if target.is_synthetic() {
|
||||
cargo.env("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET", "1");
|
||||
}
|
||||
|
||||
let _guard = builder.msg(
|
||||
Kind::Build,
|
||||
compiler.stage,
|
||||
|
|
@ -314,7 +319,7 @@ fn copy_self_contained_objects(
|
|||
}
|
||||
} else if target.ends_with("windows-gnu") {
|
||||
for obj in ["crt2.o", "dllcrt2.o"].iter() {
|
||||
let src = compiler_file(builder, builder.cc(target), target, CLang::C, obj);
|
||||
let src = compiler_file(builder, &builder.cc(target), target, CLang::C, obj);
|
||||
let target = libdir_self_contained.join(obj);
|
||||
builder.copy(&src, &target);
|
||||
target_deps.push((target, DependencyType::TargetSelfContained));
|
||||
|
|
@ -995,8 +1000,13 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect
|
|||
&& !target.contains("apple")
|
||||
&& !target.contains("solaris")
|
||||
{
|
||||
let file =
|
||||
compiler_file(builder, builder.cxx(target).unwrap(), target, CLang::Cxx, "libstdc++.a");
|
||||
let file = compiler_file(
|
||||
builder,
|
||||
&builder.cxx(target).unwrap(),
|
||||
target,
|
||||
CLang::Cxx,
|
||||
"libstdc++.a",
|
||||
);
|
||||
cargo.env("LLVM_STATIC_STDCPP", file);
|
||||
}
|
||||
if builder.llvm_link_shared() {
|
||||
|
|
@ -1267,6 +1277,9 @@ pub fn compiler_file(
|
|||
c: CLang,
|
||||
file: &str,
|
||||
) -> PathBuf {
|
||||
if builder.config.dry_run() {
|
||||
return PathBuf::new();
|
||||
}
|
||||
let mut cmd = Command::new(compiler);
|
||||
cmd.args(builder.cflags(target, GitRepo::Rustc, c));
|
||||
cmd.arg(format!("-print-file-name={}", file));
|
||||
|
|
|
|||
|
|
@ -429,6 +429,7 @@ impl std::str::FromStr for RustcLto {
|
|||
pub struct TargetSelection {
|
||||
pub triple: Interned<String>,
|
||||
file: Option<Interned<String>>,
|
||||
synthetic: bool,
|
||||
}
|
||||
|
||||
/// Newtype over `Vec<TargetSelection>` so we can implement custom parsing logic
|
||||
|
|
@ -460,7 +461,15 @@ impl TargetSelection {
|
|||
let triple = INTERNER.intern_str(triple);
|
||||
let file = file.map(|f| INTERNER.intern_str(f));
|
||||
|
||||
Self { triple, file }
|
||||
Self { triple, file, synthetic: false }
|
||||
}
|
||||
|
||||
pub fn create_synthetic(triple: &str, file: &str) -> Self {
|
||||
Self {
|
||||
triple: INTERNER.intern_str(triple),
|
||||
file: Some(INTERNER.intern_str(file)),
|
||||
synthetic: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rustc_target_arg(&self) -> &str {
|
||||
|
|
@ -478,6 +487,11 @@ impl TargetSelection {
|
|||
pub fn ends_with(&self, needle: &str) -> bool {
|
||||
self.triple.ends_with(needle)
|
||||
}
|
||||
|
||||
// See src/bootstrap/synthetic_targets.rs
|
||||
pub fn is_synthetic(&self) -> bool {
|
||||
self.synthetic
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for TargetSelection {
|
||||
|
|
|
|||
|
|
@ -170,6 +170,10 @@ fn make_win_dist(
|
|||
target: TargetSelection,
|
||||
builder: &Builder<'_>,
|
||||
) {
|
||||
if builder.config.dry_run() {
|
||||
return;
|
||||
}
|
||||
|
||||
//Ask gcc where it keeps its stuff
|
||||
let mut cmd = Command::new(builder.cc(target));
|
||||
cmd.arg("-print-search-dirs");
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ mod run;
|
|||
mod sanity;
|
||||
mod setup;
|
||||
mod suggest;
|
||||
mod synthetic_targets;
|
||||
mod tarball;
|
||||
mod test;
|
||||
mod tool;
|
||||
|
|
@ -226,10 +227,10 @@ pub struct Build {
|
|||
|
||||
// Runtime state filled in later on
|
||||
// C/C++ compilers and archiver for all targets
|
||||
cc: HashMap<TargetSelection, cc::Tool>,
|
||||
cxx: HashMap<TargetSelection, cc::Tool>,
|
||||
ar: HashMap<TargetSelection, PathBuf>,
|
||||
ranlib: HashMap<TargetSelection, PathBuf>,
|
||||
cc: RefCell<HashMap<TargetSelection, cc::Tool>>,
|
||||
cxx: RefCell<HashMap<TargetSelection, cc::Tool>>,
|
||||
ar: RefCell<HashMap<TargetSelection, PathBuf>>,
|
||||
ranlib: RefCell<HashMap<TargetSelection, PathBuf>>,
|
||||
// Miscellaneous
|
||||
// allow bidirectional lookups: both name -> path and path -> name
|
||||
crates: HashMap<Interned<String>, Crate>,
|
||||
|
|
@ -451,10 +452,10 @@ impl Build {
|
|||
miri_info,
|
||||
rustfmt_info,
|
||||
in_tree_llvm_info,
|
||||
cc: HashMap::new(),
|
||||
cxx: HashMap::new(),
|
||||
ar: HashMap::new(),
|
||||
ranlib: HashMap::new(),
|
||||
cc: RefCell::new(HashMap::new()),
|
||||
cxx: RefCell::new(HashMap::new()),
|
||||
ar: RefCell::new(HashMap::new()),
|
||||
ranlib: RefCell::new(HashMap::new()),
|
||||
crates: HashMap::new(),
|
||||
crate_paths: HashMap::new(),
|
||||
is_sudo,
|
||||
|
|
@ -482,7 +483,7 @@ impl Build {
|
|||
}
|
||||
|
||||
build.verbose("finding compilers");
|
||||
cc_detect::find(&mut build);
|
||||
cc_detect::find(&build);
|
||||
// When running `setup`, the profile is about to change, so any requirements we have now may
|
||||
// be different on the next invocation. Don't check for them until the next time x.py is
|
||||
// run. This is ok because `setup` never runs any build commands, so it won't fail if commands are missing.
|
||||
|
|
@ -1103,16 +1104,22 @@ impl Build {
|
|||
}
|
||||
|
||||
/// Returns the path to the C compiler for the target specified.
|
||||
fn cc(&self, target: TargetSelection) -> &Path {
|
||||
self.cc[&target].path()
|
||||
fn cc(&self, target: TargetSelection) -> PathBuf {
|
||||
if self.config.dry_run() {
|
||||
return PathBuf::new();
|
||||
}
|
||||
self.cc.borrow()[&target].path().into()
|
||||
}
|
||||
|
||||
/// Returns a list of flags to pass to the C compiler for the target
|
||||
/// specified.
|
||||
fn cflags(&self, target: TargetSelection, which: GitRepo, c: CLang) -> Vec<String> {
|
||||
if self.config.dry_run() {
|
||||
return Vec::new();
|
||||
}
|
||||
let base = match c {
|
||||
CLang::C => &self.cc[&target],
|
||||
CLang::Cxx => &self.cxx[&target],
|
||||
CLang::C => self.cc.borrow()[&target].clone(),
|
||||
CLang::Cxx => self.cxx.borrow()[&target].clone(),
|
||||
};
|
||||
|
||||
// Filter out -O and /O (the optimization flags) that we picked up from
|
||||
|
|
@ -1153,19 +1160,28 @@ impl Build {
|
|||
}
|
||||
|
||||
/// Returns the path to the `ar` archive utility for the target specified.
|
||||
fn ar(&self, target: TargetSelection) -> Option<&Path> {
|
||||
self.ar.get(&target).map(|p| &**p)
|
||||
fn ar(&self, target: TargetSelection) -> Option<PathBuf> {
|
||||
if self.config.dry_run() {
|
||||
return None;
|
||||
}
|
||||
self.ar.borrow().get(&target).cloned()
|
||||
}
|
||||
|
||||
/// Returns the path to the `ranlib` utility for the target specified.
|
||||
fn ranlib(&self, target: TargetSelection) -> Option<&Path> {
|
||||
self.ranlib.get(&target).map(|p| &**p)
|
||||
fn ranlib(&self, target: TargetSelection) -> Option<PathBuf> {
|
||||
if self.config.dry_run() {
|
||||
return None;
|
||||
}
|
||||
self.ranlib.borrow().get(&target).cloned()
|
||||
}
|
||||
|
||||
/// Returns the path to the C++ compiler for the target specified.
|
||||
fn cxx(&self, target: TargetSelection) -> Result<&Path, String> {
|
||||
match self.cxx.get(&target) {
|
||||
Some(p) => Ok(p.path()),
|
||||
fn cxx(&self, target: TargetSelection) -> Result<PathBuf, String> {
|
||||
if self.config.dry_run() {
|
||||
return Ok(PathBuf::new());
|
||||
}
|
||||
match self.cxx.borrow().get(&target) {
|
||||
Some(p) => Ok(p.path().into()),
|
||||
None => {
|
||||
Err(format!("target `{}` is not configured as a host, only as a target", target))
|
||||
}
|
||||
|
|
@ -1173,21 +1189,24 @@ impl Build {
|
|||
}
|
||||
|
||||
/// Returns the path to the linker for the given target if it needs to be overridden.
|
||||
fn linker(&self, target: TargetSelection) -> Option<&Path> {
|
||||
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref())
|
||||
fn linker(&self, target: TargetSelection) -> Option<PathBuf> {
|
||||
if self.config.dry_run() {
|
||||
return Some(PathBuf::new());
|
||||
}
|
||||
if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.clone())
|
||||
{
|
||||
Some(linker)
|
||||
} else if target.contains("vxworks") {
|
||||
// need to use CXX compiler as linker to resolve the exception functions
|
||||
// that are only existed in CXX libraries
|
||||
Some(self.cxx[&target].path())
|
||||
Some(self.cxx.borrow()[&target].path().into())
|
||||
} else if target != self.config.build
|
||||
&& util::use_host_linker(target)
|
||||
&& !target.contains("msvc")
|
||||
{
|
||||
Some(self.cc(target))
|
||||
} else if self.config.use_lld && !self.is_fuse_ld_lld(target) && self.build == target {
|
||||
Some(&self.initial_lld)
|
||||
Some(self.initial_lld.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ fn configure_cmake(
|
|||
}
|
||||
|
||||
let (cc, cxx) = match builder.config.llvm_clang_cl {
|
||||
Some(ref cl) => (cl.as_ref(), cl.as_ref()),
|
||||
Some(ref cl) => (cl.into(), cl.into()),
|
||||
None => (builder.cc(target), builder.cxx(target).unwrap()),
|
||||
};
|
||||
|
||||
|
|
@ -656,9 +656,9 @@ fn configure_cmake(
|
|||
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
|
||||
}
|
||||
}
|
||||
cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc))
|
||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx))
|
||||
.define("CMAKE_ASM_COMPILER", sanitize_cc(cc));
|
||||
cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
|
||||
.define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx))
|
||||
.define("CMAKE_ASM_COMPILER", sanitize_cc(&cc));
|
||||
}
|
||||
|
||||
cfg.build_arg("-j").build_arg(builder.jobs().to_string());
|
||||
|
|
@ -698,7 +698,7 @@ fn configure_cmake(
|
|||
if ar.is_absolute() {
|
||||
// LLVM build breaks if `CMAKE_AR` is a relative path, for some reason it
|
||||
// tries to resolve this path in the LLVM build directory.
|
||||
cfg.define("CMAKE_AR", sanitize_cc(ar));
|
||||
cfg.define("CMAKE_AR", sanitize_cc(&ar));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -706,7 +706,7 @@ fn configure_cmake(
|
|||
if ranlib.is_absolute() {
|
||||
// LLVM build breaks if `CMAKE_RANLIB` is a relative path, for some reason it
|
||||
// tries to resolve this path in the LLVM build directory.
|
||||
cfg.define("CMAKE_RANLIB", sanitize_cc(ranlib));
|
||||
cfg.define("CMAKE_RANLIB", sanitize_cc(&ranlib));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
82
src/bootstrap/synthetic_targets.rs
Normal file
82
src/bootstrap/synthetic_targets.rs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
//! In some cases, parts of bootstrap need to change part of a target spec just for one or a few
|
||||
//! steps. Adding these targets to rustc proper would "leak" this implementation detail of
|
||||
//! bootstrap, and would make it more complex to apply additional changes if the need arises.
|
||||
//!
|
||||
//! To address that problem, this module implements support for "synthetic targets". Synthetic
|
||||
//! targets are custom target specs generated using builtin target specs as their base. You can use
|
||||
//! one of the target specs already defined in this module, or create new ones by adding a new step
|
||||
//! that calls create_synthetic_target.
|
||||
|
||||
use crate::builder::{Builder, ShouldRun, Step};
|
||||
use crate::config::TargetSelection;
|
||||
use crate::Compiler;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct MirOptPanicAbortSyntheticTarget {
|
||||
pub(crate) compiler: Compiler,
|
||||
pub(crate) base: TargetSelection,
|
||||
}
|
||||
|
||||
impl Step for MirOptPanicAbortSyntheticTarget {
|
||||
type Output = TargetSelection;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = false;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.never()
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) -> Self::Output {
|
||||
create_synthetic_target(builder, self.compiler, "miropt-abort", self.base, |spec| {
|
||||
spec.insert("panic-strategy".into(), "abort".into());
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn create_synthetic_target(
|
||||
builder: &Builder<'_>,
|
||||
compiler: Compiler,
|
||||
suffix: &str,
|
||||
base: TargetSelection,
|
||||
customize: impl FnOnce(&mut serde_json::Map<String, serde_json::Value>),
|
||||
) -> TargetSelection {
|
||||
if base.contains("synthetic") {
|
||||
// This check is not strictly needed, but nothing currently needs recursive synthetic
|
||||
// targets. If the need arises, removing this in the future *SHOULD* be safe.
|
||||
panic!("cannot create synthetic targets with other synthetic targets as their base");
|
||||
}
|
||||
|
||||
let name = format!("{base}-synthetic-{suffix}");
|
||||
let path = builder.out.join("synthetic-target-specs").join(format!("{name}.json"));
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
|
||||
if builder.config.dry_run() {
|
||||
std::fs::write(&path, b"dry run\n").unwrap();
|
||||
return TargetSelection::create_synthetic(&name, path.to_str().unwrap());
|
||||
}
|
||||
|
||||
let mut cmd = Command::new(builder.rustc(compiler));
|
||||
cmd.arg("--target").arg(base.rustc_target_arg());
|
||||
cmd.args(["-Zunstable-options", "--print", "target-spec-json"]);
|
||||
cmd.stdout(Stdio::piped());
|
||||
|
||||
let output = cmd.spawn().unwrap().wait_with_output().unwrap();
|
||||
if !output.status.success() {
|
||||
panic!("failed to gather the target spec for {base}");
|
||||
}
|
||||
|
||||
let mut spec: serde_json::Value = serde_json::from_slice(&output.stdout).unwrap();
|
||||
let spec_map = spec.as_object_mut().unwrap();
|
||||
|
||||
// The `is-builtin` attribute of a spec needs to be removed, otherwise rustc will complain.
|
||||
spec_map.remove("is-builtin");
|
||||
|
||||
customize(spec_map);
|
||||
|
||||
std::fs::write(&path, &serde_json::to_vec_pretty(&spec).unwrap()).unwrap();
|
||||
let target = TargetSelection::create_synthetic(&name, path.to_str().unwrap());
|
||||
crate::cc_detect::find_target(builder, target);
|
||||
|
||||
target
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ use crate::doc::DocumentationFormat;
|
|||
use crate::flags::Subcommand;
|
||||
use crate::llvm;
|
||||
use crate::render_tests::add_flags_and_try_run_tests;
|
||||
use crate::synthetic_targets::MirOptPanicAbortSyntheticTarget;
|
||||
use crate::tool::{self, SourceType, Tool};
|
||||
use crate::toolstate::ToolState;
|
||||
use crate::util::{self, add_link_lib_path, dylib_path, dylib_path_var, output, t, up_to_date};
|
||||
|
|
@ -30,6 +31,22 @@ use crate::{envify, CLang, DocTests, GitRepo, Mode};
|
|||
|
||||
const ADB_TEST_DIR: &str = "/data/local/tmp/work";
|
||||
|
||||
// mir-opt tests have different variants depending on whether a target is 32bit or 64bit, and
|
||||
// blessing them requires blessing with each target. To aid developers, when blessing the mir-opt
|
||||
// test suite the corresponding target of the opposite pointer size is also blessed.
|
||||
//
|
||||
// This array serves as the known mappings between 32bit and 64bit targets. If you're developing on
|
||||
// a target where a target with the opposite pointer size exists, feel free to add it here.
|
||||
const MIR_OPT_BLESS_TARGET_MAPPING: &[(&str, &str)] = &[
|
||||
// (32bit, 64bit)
|
||||
("i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"),
|
||||
("i686-unknown-linux-musl", "x86_64-unknown-linux-musl"),
|
||||
("i686-pc-windows-msvc", "x86_64-pc-windows-msvc"),
|
||||
("i686-pc-windows-gnu", "x86_64-pc-windows-gnu"),
|
||||
("i686-apple-darwin", "x86_64-apple-darwin"),
|
||||
("i686-apple-darwin", "aarch64-apple-darwin"),
|
||||
];
|
||||
|
||||
fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool {
|
||||
if !builder.fail_fast {
|
||||
if !builder.try_run(cmd) {
|
||||
|
|
@ -1261,8 +1278,6 @@ default_test!(RunPassValgrind {
|
|||
suite: "run-pass-valgrind"
|
||||
});
|
||||
|
||||
default_test!(MirOpt { path: "tests/mir-opt", mode: "mir-opt", suite: "mir-opt" });
|
||||
|
||||
default_test!(Codegen { path: "tests/codegen", mode: "codegen", suite: "codegen" });
|
||||
|
||||
default_test!(CodegenUnits {
|
||||
|
|
@ -1299,6 +1314,91 @@ host_test!(RunMakeFullDeps {
|
|||
|
||||
default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" });
|
||||
|
||||
// For the mir-opt suite we do not use macros, as we need custom behavior when blessing.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct MirOpt {
|
||||
pub compiler: Compiler,
|
||||
pub target: TargetSelection,
|
||||
}
|
||||
|
||||
impl Step for MirOpt {
|
||||
type Output = ();
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = false;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
run.suite_path("tests/mir-opt")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
|
||||
run.builder.ensure(MirOpt { compiler, target: run.target });
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let run = |target| {
|
||||
builder.ensure(Compiletest {
|
||||
compiler: self.compiler,
|
||||
target: target,
|
||||
mode: "mir-opt",
|
||||
suite: "mir-opt",
|
||||
path: "tests/mir-opt",
|
||||
compare_mode: None,
|
||||
})
|
||||
};
|
||||
|
||||
// We use custom logic to bless the mir-opt suite: mir-opt tests have multiple variants
|
||||
// (32bit vs 64bit, and panic=abort vs panic=unwind), and all of them needs to be blessed.
|
||||
// When blessing, we try best-effort to also bless the other variants, to aid developers.
|
||||
if builder.config.cmd.bless() {
|
||||
let targets = MIR_OPT_BLESS_TARGET_MAPPING
|
||||
.iter()
|
||||
.filter(|(target_32bit, target_64bit)| {
|
||||
*target_32bit == &*self.target.triple || *target_64bit == &*self.target.triple
|
||||
})
|
||||
.next()
|
||||
.map(|(target_32bit, target_64bit)| {
|
||||
let target_32bit = TargetSelection::from_user(target_32bit);
|
||||
let target_64bit = TargetSelection::from_user(target_64bit);
|
||||
|
||||
// Running compiletest requires a C compiler to be available, but it might not
|
||||
// have been detected by bootstrap if the target we're testing wasn't in the
|
||||
// --target flags.
|
||||
if !builder.cc.borrow().contains_key(&target_32bit) {
|
||||
crate::cc_detect::find_target(builder, target_32bit);
|
||||
}
|
||||
if !builder.cc.borrow().contains_key(&target_64bit) {
|
||||
crate::cc_detect::find_target(builder, target_64bit);
|
||||
}
|
||||
|
||||
vec![target_32bit, target_64bit]
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
eprintln!(
|
||||
"\
|
||||
Note that not all variants of mir-opt tests are going to be blessed, as no mapping between
|
||||
a 32bit and a 64bit target was found for {target}.
|
||||
You can add that mapping by changing MIR_OPT_BLESS_TARGET_MAPPING in src/bootstrap/test.rs",
|
||||
target = self.target,
|
||||
);
|
||||
vec![self.target]
|
||||
});
|
||||
|
||||
for target in targets {
|
||||
run(target);
|
||||
|
||||
let panic_abort_target = builder.ensure(MirOptPanicAbortSyntheticTarget {
|
||||
compiler: self.compiler,
|
||||
base: target,
|
||||
});
|
||||
run(panic_abort_target);
|
||||
}
|
||||
} else {
|
||||
run(self.target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
struct Compiletest {
|
||||
compiler: Compiler,
|
||||
|
|
@ -1667,7 +1767,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||
// Note that if we encounter `PATH` we make sure to append to our own `PATH`
|
||||
// rather than stomp over it.
|
||||
if target.contains("msvc") {
|
||||
for &(ref k, ref v) in builder.cc[&target].env() {
|
||||
for &(ref k, ref v) in builder.cc.borrow()[&target].env() {
|
||||
if k != "PATH" {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
|
|
@ -1692,7 +1792,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||
|
||||
cmd.arg("--adb-path").arg("adb");
|
||||
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
|
||||
if target.contains("android") {
|
||||
if target.contains("android") && !builder.config.dry_run() {
|
||||
// Assume that cc for this target comes from the android sysroot
|
||||
cmd.arg("--android-cross-path")
|
||||
.arg(builder.cc(target).parent().unwrap().parent().unwrap());
|
||||
|
|
|
|||
|
|
@ -855,7 +855,7 @@ impl<'a> Builder<'a> {
|
|||
if compiler.host.contains("msvc") {
|
||||
let curpaths = env::var_os("PATH").unwrap_or_default();
|
||||
let curpaths = env::split_paths(&curpaths).collect::<Vec<_>>();
|
||||
for &(ref k, ref v) in self.cc[&compiler.host].env() {
|
||||
for &(ref k, ref v) in self.cc.borrow()[&compiler.host].env() {
|
||||
if k != "PATH" {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,15 @@ pub enum PanicStrategy {
|
|||
Abort,
|
||||
}
|
||||
|
||||
impl PanicStrategy {
|
||||
pub(crate) fn for_miropt_test_tools(&self) -> miropt_test_tools::PanicStrategy {
|
||||
match self {
|
||||
PanicStrategy::Unwind => miropt_test_tools::PanicStrategy::Unwind,
|
||||
PanicStrategy::Abort => miropt_test_tools::PanicStrategy::Abort,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration for compiletest
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct Config {
|
||||
|
|
@ -572,7 +581,7 @@ pub struct TargetCfg {
|
|||
#[serde(rename = "target-endian", default)]
|
||||
endian: Endian,
|
||||
#[serde(rename = "panic-strategy", default)]
|
||||
panic: PanicStrategy,
|
||||
pub(crate) panic: PanicStrategy,
|
||||
}
|
||||
|
||||
impl TargetCfg {
|
||||
|
|
|
|||
|
|
@ -3565,6 +3565,7 @@ impl<'test> TestCx<'test> {
|
|||
let files = miropt_test_tools::files_for_miropt_test(
|
||||
&self.testpaths.file,
|
||||
self.config.get_pointer_width(),
|
||||
self.config.target_cfg().panic.for_miropt_test_tools(),
|
||||
);
|
||||
|
||||
let mut out = Vec::new();
|
||||
|
|
@ -3582,25 +3583,24 @@ impl<'test> TestCx<'test> {
|
|||
}
|
||||
|
||||
fn check_mir_dump(&self) {
|
||||
let test_file_contents = fs::read_to_string(&self.testpaths.file).unwrap();
|
||||
|
||||
let test_dir = self.testpaths.file.parent().unwrap();
|
||||
let test_crate =
|
||||
self.testpaths.file.file_stem().unwrap().to_str().unwrap().replace("-", "_");
|
||||
|
||||
let mut bit_width = String::new();
|
||||
if test_file_contents.lines().any(|l| l == "// EMIT_MIR_FOR_EACH_BIT_WIDTH") {
|
||||
bit_width = format!(".{}bit", self.config.get_pointer_width());
|
||||
}
|
||||
let suffix = miropt_test_tools::output_file_suffix(
|
||||
&self.testpaths.file,
|
||||
self.config.get_pointer_width(),
|
||||
self.config.target_cfg().panic.for_miropt_test_tools(),
|
||||
);
|
||||
|
||||
if self.config.bless {
|
||||
for e in
|
||||
glob(&format!("{}/{}.*{}.mir", test_dir.display(), test_crate, bit_width)).unwrap()
|
||||
glob(&format!("{}/{}.*{}.mir", test_dir.display(), test_crate, suffix)).unwrap()
|
||||
{
|
||||
std::fs::remove_file(e.unwrap()).unwrap();
|
||||
}
|
||||
for e in
|
||||
glob(&format!("{}/{}.*{}.diff", test_dir.display(), test_crate, bit_width)).unwrap()
|
||||
glob(&format!("{}/{}.*{}.diff", test_dir.display(), test_crate, suffix)).unwrap()
|
||||
{
|
||||
std::fs::remove_file(e.unwrap()).unwrap();
|
||||
}
|
||||
|
|
@ -3609,6 +3609,7 @@ impl<'test> TestCx<'test> {
|
|||
let files = miropt_test_tools::files_for_miropt_test(
|
||||
&self.testpaths.file,
|
||||
self.config.get_pointer_width(),
|
||||
self.config.target_cfg().panic.for_miropt_test_tools(),
|
||||
);
|
||||
for miropt_test_tools::MiroptTestFiles { from_file, to_file, expected_file, passes: _ } in
|
||||
files
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub struct MiroptTestFiles {
|
||||
pub expected_file: std::path::PathBuf,
|
||||
|
|
@ -8,18 +9,52 @@ pub struct MiroptTestFiles {
|
|||
pub passes: Vec<String>,
|
||||
}
|
||||
|
||||
pub fn files_for_miropt_test(testfile: &std::path::Path, bit_width: u32) -> Vec<MiroptTestFiles> {
|
||||
pub enum PanicStrategy {
|
||||
Unwind,
|
||||
Abort,
|
||||
}
|
||||
|
||||
pub fn output_file_suffix(
|
||||
testfile: &Path,
|
||||
bit_width: u32,
|
||||
panic_strategy: PanicStrategy,
|
||||
) -> String {
|
||||
let mut each_bit_width = false;
|
||||
let mut each_panic_strategy = false;
|
||||
for line in fs::read_to_string(testfile).unwrap().lines() {
|
||||
if line == "// EMIT_MIR_FOR_EACH_BIT_WIDTH" {
|
||||
each_bit_width = true;
|
||||
}
|
||||
if line == "// EMIT_MIR_FOR_EACH_PANIC_STRATEGY" {
|
||||
each_panic_strategy = true;
|
||||
}
|
||||
}
|
||||
|
||||
let mut suffix = String::new();
|
||||
if each_bit_width {
|
||||
suffix.push_str(&format!(".{}bit", bit_width));
|
||||
}
|
||||
if each_panic_strategy {
|
||||
match panic_strategy {
|
||||
PanicStrategy::Unwind => suffix.push_str(".panic-unwind"),
|
||||
PanicStrategy::Abort => suffix.push_str(".panic-abort"),
|
||||
}
|
||||
}
|
||||
suffix
|
||||
}
|
||||
|
||||
pub fn files_for_miropt_test(
|
||||
testfile: &std::path::Path,
|
||||
bit_width: u32,
|
||||
panic_strategy: PanicStrategy,
|
||||
) -> Vec<MiroptTestFiles> {
|
||||
let mut out = Vec::new();
|
||||
let test_file_contents = fs::read_to_string(&testfile).unwrap();
|
||||
|
||||
let test_dir = testfile.parent().unwrap();
|
||||
let test_crate = testfile.file_stem().unwrap().to_str().unwrap().replace('-', "_");
|
||||
|
||||
let bit_width = if test_file_contents.lines().any(|l| l == "// EMIT_MIR_FOR_EACH_BIT_WIDTH") {
|
||||
format!(".{}bit", bit_width)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
let suffix = output_file_suffix(testfile, bit_width, panic_strategy);
|
||||
|
||||
for l in test_file_contents.lines() {
|
||||
if l.starts_with("// EMIT_MIR ") {
|
||||
|
|
@ -37,7 +72,7 @@ pub fn files_for_miropt_test(testfile: &std::path::Path, bit_width: u32) -> Vec<
|
|||
passes.push(trimmed.split('.').last().unwrap().to_owned());
|
||||
let test_against = format!("{}.after.mir", trimmed);
|
||||
from_file = format!("{}.before.mir", trimmed);
|
||||
expected_file = format!("{}{}.diff", trimmed, bit_width);
|
||||
expected_file = format!("{}{}.diff", trimmed, suffix);
|
||||
assert!(test_names.next().is_none(), "two mir pass names specified for MIR diff");
|
||||
to_file = Some(test_against);
|
||||
} else if let Some(first_pass) = test_names.next() {
|
||||
|
|
@ -51,7 +86,7 @@ pub fn files_for_miropt_test(testfile: &std::path::Path, bit_width: u32) -> Vec<
|
|||
assert!(test_names.next().is_none(), "three mir pass names specified for MIR diff");
|
||||
|
||||
expected_file =
|
||||
format!("{}{}.{}-{}.diff", test_name, bit_width, first_pass, second_pass);
|
||||
format!("{}{}.{}-{}.diff", test_name, suffix, first_pass, second_pass);
|
||||
let second_file = format!("{}.{}.mir", test_name, second_pass);
|
||||
from_file = format!("{}.{}.mir", test_name, first_pass);
|
||||
to_file = Some(second_file);
|
||||
|
|
@ -64,7 +99,7 @@ pub fn files_for_miropt_test(testfile: &std::path::Path, bit_width: u32) -> Vec<
|
|||
let extension = cap.get(1).unwrap().as_str();
|
||||
|
||||
expected_file =
|
||||
format!("{}{}{}", test_name.trim_end_matches(extension), bit_width, extension,);
|
||||
format!("{}{}{}", test_name.trim_end_matches(extension), suffix, extension,);
|
||||
from_file = test_name.to_string();
|
||||
assert!(test_names.next().is_none(), "two mir pass names specified for MIR dump");
|
||||
to_file = None;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
//! Tidy check to ensure that mir opt directories do not have stale files or dashes in file names
|
||||
|
||||
use miropt_test_tools::PanicStrategy;
|
||||
use std::collections::HashSet;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
|
@ -24,8 +25,10 @@ fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
|
|||
|
||||
for file in rs_files {
|
||||
for bw in [32, 64] {
|
||||
for output_file in miropt_test_tools::files_for_miropt_test(&file, bw) {
|
||||
output_files.remove(&output_file.expected_file);
|
||||
for ps in [PanicStrategy::Unwind, PanicStrategy::Abort] {
|
||||
for output_file in miropt_test_tools::files_for_miropt_test(&file, bw, ps) {
|
||||
output_files.remove(&output_file.expected_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
// MIR for `main` after SimplifyCfg-elaborate-drops
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +0:11
|
||||
let mut _1: [u32; 3]; // in scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
|
||||
let mut _4: &mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
|
||||
let mut _5: u32; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
|
||||
let mut _6: *mut usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
|
||||
let _7: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
|
||||
let mut _8: usize; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
|
||||
let mut _9: bool; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
|
||||
let mut _2: usize; // in scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
|
||||
let _3: *mut usize; // in scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
|
||||
scope 3 {
|
||||
debug z => _3; // in scope 3 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
|
||||
scope 4 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
|
||||
_1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array_index_is_temporary.rs:+1:17: +1:29
|
||||
StorageLive(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
|
||||
_2 = const 1_usize; // scope 1 at $DIR/array_index_is_temporary.rs:+2:17: +2:18
|
||||
StorageLive(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
|
||||
StorageLive(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
|
||||
_4 = &mut _2; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
|
||||
_3 = &raw mut (*_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
|
||||
StorageDead(_4); // scope 2 at $DIR/array_index_is_temporary.rs:+3:31: +3:32
|
||||
StorageLive(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
|
||||
StorageLive(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
|
||||
_6 = _3; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
|
||||
_5 = foo(move _6) -> [return: bb1, unwind unreachable]; // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index_is_temporary.rs:17:21: 17:24
|
||||
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_6); // scope 4 at $DIR/array_index_is_temporary.rs:+4:26: +4:27
|
||||
StorageLive(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
|
||||
_7 = _2; // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
|
||||
_8 = Len(_1); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
|
||||
_9 = Lt(_7, _8); // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
|
||||
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_1[_7] = move _5; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:29
|
||||
StorageDead(_5); // scope 3 at $DIR/array_index_is_temporary.rs:+4:28: +4:29
|
||||
StorageDead(_7); // scope 3 at $DIR/array_index_is_temporary.rs:+4:29: +4:30
|
||||
_0 = const (); // scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +5:2
|
||||
StorageDead(_3); // scope 2 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
|
||||
StorageDead(_2); // scope 1 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
|
||||
StorageDead(_1); // scope 0 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/array_index_is_temporary.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// Retagging (from Stacked Borrows) relies on the array index being a fresh
|
||||
// temporary, so that side-effects cannot change it.
|
||||
// Test that this is indeed the case.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
// MIR for `main` before ElaborateDrops
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:+0:11: +0:11
|
||||
let _1: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+1:9: +1:10
|
||||
let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
let mut _5: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
let _6: (); // in scope 0 at $DIR/box_expr.rs:+3:5: +3:12
|
||||
let mut _7: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:+3:10: +3:11
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/box_expr.rs:+1:9: +1:10
|
||||
}
|
||||
scope 2 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/box_expr.rs:+1:9: +1:10
|
||||
_2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
_3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind: bb9]; // scope 2 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
// mir::Constant
|
||||
// + span: $DIR/box_expr.rs:8:5: 8:23
|
||||
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_5); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
_5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
(*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:+2:14: +2:22
|
||||
// mir::Constant
|
||||
// + span: $DIR/box_expr.rs:8:14: 8:20
|
||||
// + literal: Const { ty: fn() -> S {S::new}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_1 = move _5; // scope 0 at $DIR/box_expr.rs:+2:5: +2:23
|
||||
drop(_5) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_5); // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
|
||||
StorageLive(_6); // scope 1 at $DIR/box_expr.rs:+3:5: +3:12
|
||||
StorageLive(_7); // scope 1 at $DIR/box_expr.rs:+3:10: +3:11
|
||||
_7 = move _1; // scope 1 at $DIR/box_expr.rs:+3:10: +3:11
|
||||
_6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:+3:5: +3:12
|
||||
// mir::Constant
|
||||
// + span: $DIR/box_expr.rs:9:5: 9:9
|
||||
// + literal: Const { ty: fn(Box<S>) {std::mem::drop::<Box<S>>}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_7); // scope 1 at $DIR/box_expr.rs:+3:11: +3:12
|
||||
StorageDead(_6); // scope 1 at $DIR/box_expr.rs:+3:12: +3:13
|
||||
_0 = const (); // scope 0 at $DIR/box_expr.rs:+0:11: +4:2
|
||||
drop(_1) -> [return: bb5, unwind: bb9]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageDead(_1); // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/box_expr.rs:+4:2: +4:2
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
drop(_7) -> [return: bb7, unwind terminate]; // scope 1 at $DIR/box_expr.rs:+3:11: +3:12
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
drop(_1) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+4:1: +4:2
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
drop(_5) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/box_expr.rs:+2:22: +2:23
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
resume; // scope 0 at $DIR/box_expr.rs:+0:1: +4:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
|
||||
#![feature(rustc_attrs, stmt_expr_attributes)]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
- // MIR for `norm2` before InstSimplify
|
||||
+ // MIR for `norm2` after InstSimplify
|
||||
|
||||
fn norm2(_1: [f32; 2]) -> f32 {
|
||||
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11
|
||||
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:+0:26: +0:29
|
||||
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10
|
||||
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
|
||||
let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:15: +2:16
|
||||
let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:8
|
||||
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:6
|
||||
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:7: +3:8
|
||||
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:14
|
||||
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:12
|
||||
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
scope 1 {
|
||||
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:+1:9: +1:10
|
||||
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10
|
||||
scope 2 {
|
||||
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:+2:9: +2:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10
|
||||
StorageLive(_3); // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
|
||||
_3 = const 0_usize; // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16
|
||||
- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
+ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
_5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = _1[_3]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17
|
||||
StorageDead(_3); // scope 0 at $DIR/combine_array_len.rs:+1:17: +1:18
|
||||
StorageLive(_6); // scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10
|
||||
StorageLive(_7); // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16
|
||||
_7 = const 1_usize; // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16
|
||||
- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
+ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
_9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_6 = _1[_7]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17
|
||||
StorageDead(_7); // scope 1 at $DIR/combine_array_len.rs:+2:17: +2:18
|
||||
StorageLive(_10); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8
|
||||
StorageLive(_11); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6
|
||||
_11 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6
|
||||
StorageLive(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
|
||||
_12 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
|
||||
_10 = Mul(move _11, move _12); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8
|
||||
StorageDead(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
|
||||
StorageDead(_11); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8
|
||||
StorageLive(_13); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14
|
||||
StorageLive(_14); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12
|
||||
_14 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12
|
||||
StorageLive(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
_15 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
_13 = Mul(move _14, move _15); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14
|
||||
StorageDead(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
StorageDead(_14); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
_0 = Add(move _10, move _13); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:14
|
||||
StorageDead(_13); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
StorageDead(_10); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14
|
||||
StorageDead(_6); // scope 1 at $DIR/combine_array_len.rs:+4:1: +4:2
|
||||
StorageDead(_2); // scope 0 at $DIR/combine_array_len.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/combine_array_len.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: InstSimplify
|
||||
// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// unit-test: InstSimplify
|
||||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
|
||||
// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` before InstSimplify
|
||||
+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` after InstSimplify
|
||||
|
||||
fn <impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
|
||||
debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
|
||||
let mut _0: MyThing<T>; // return place in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
|
||||
let mut _2: T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
let mut _3: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
let _4: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
let mut _5: u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
let mut _6: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
let _7: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
let mut _8: [f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
let mut _9: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
let _10: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
StorageLive(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
StorageLive(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
_4 = &((*_1).0: T); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
- _3 = &(*_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
+ _3 = _4; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
_2 = <T as Clone>::clone(move _3) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
// mir::Constant
|
||||
// + span: $DIR/combine_clone_of_primitives.rs:8:5: 8:9
|
||||
// + literal: Const { ty: for<'a> fn(&'a T) -> T {<T as Clone>::clone}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:8: 8:9
|
||||
StorageLive(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
StorageLive(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
StorageLive(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
_7 = &((*_1).1: u64); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
- _6 = &(*_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
- _5 = <u64 as Clone>::clone(move _6) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
- // + literal: Const { ty: for<'a> fn(&'a u64) -> u64 {<u64 as Clone>::clone}, val: Value(<ZST>) }
|
||||
+ _6 = _7; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
+ _5 = (*_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
+ goto -> bb2; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:10: 9:11
|
||||
StorageLive(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
StorageLive(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
StorageLive(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
_10 = &((*_1).2: [f32; 3]); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
- _9 = &(*_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
- // + literal: Const { ty: for<'a> fn(&'a [f32; 3]) -> [f32; 3] {<[f32; 3] as Clone>::clone}, val: Value(<ZST>) }
|
||||
+ _9 = _10; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
+ _8 = (*_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
+ goto -> bb3; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:15: 10:16
|
||||
_0 = MyThing::<T> { v: move _2, i: move _5, a: move _8 }; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
|
||||
StorageDead(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
|
||||
StorageDead(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
|
||||
StorageDead(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
|
||||
StorageDead(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
|
||||
StorageDead(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
|
||||
StorageDead(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15
|
||||
return; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:15: +0:15
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
- // MIR for `foo` before ConstProp
|
||||
+ // MIR for `foo` after ConstProp
|
||||
|
||||
fn foo(_1: u8) -> () {
|
||||
debug x => _1; // in scope 0 at $DIR/aggregate.rs:+0:8: +0:9
|
||||
let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:15: +0:15
|
||||
let _2: i32; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:14
|
||||
let mut _3: i32; // in scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
let mut _4: (i32, u8); // in scope 0 at $DIR/aggregate.rs:+2:17: +2:23
|
||||
let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:21: +2:22
|
||||
let mut _7: i32; // in scope 0 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
let mut _8: (u8, i32); // in scope 0 at $DIR/aggregate.rs:+3:18: +3:24
|
||||
let mut _9: u8; // in scope 0 at $DIR/aggregate.rs:+3:19: +3:20
|
||||
scope 1 {
|
||||
debug first => _2; // in scope 1 at $DIR/aggregate.rs:+2:9: +2:14
|
||||
let _6: i32; // in scope 1 at $DIR/aggregate.rs:+3:9: +3:15
|
||||
scope 2 {
|
||||
debug second => _6; // in scope 2 at $DIR/aggregate.rs:+3:9: +3:15
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+2:9: +2:14
|
||||
StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
StorageLive(_4); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
|
||||
StorageLive(_5); // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
|
||||
_5 = _1; // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
|
||||
_4 = (const 0_i32, move _5); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
|
||||
StorageDead(_5); // scope 0 at $DIR/aggregate.rs:+2:22: +2:23
|
||||
- _3 = (_4.0: i32); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
- _2 = Add(move _3, const 1_i32); // scope 0 at $DIR/aggregate.rs:+2:17: +2:29
|
||||
+ _3 = const 0_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
+ _2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:29
|
||||
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+2:28: +2:29
|
||||
StorageDead(_4); // scope 0 at $DIR/aggregate.rs:+2:29: +2:30
|
||||
StorageLive(_6); // scope 1 at $DIR/aggregate.rs:+3:9: +3:15
|
||||
StorageLive(_7); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
StorageLive(_8); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
|
||||
StorageLive(_9); // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
|
||||
_9 = _1; // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
|
||||
_8 = (move _9, const 1_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
|
||||
StorageDead(_9); // scope 1 at $DIR/aggregate.rs:+3:23: +3:24
|
||||
- _7 = (_8.1: i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
- _6 = Add(move _7, const 2_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:30
|
||||
+ _7 = const 1_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
+ _6 = const 3_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:30
|
||||
StorageDead(_7); // scope 1 at $DIR/aggregate.rs:+3:29: +3:30
|
||||
StorageDead(_8); // scope 1 at $DIR/aggregate.rs:+3:30: +3:31
|
||||
_0 = const (); // scope 0 at $DIR/aggregate.rs:+0:15: +4:2
|
||||
StorageDead(_6); // scope 1 at $DIR/aggregate.rs:+4:1: +4:2
|
||||
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/aggregate.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
// MIR for `foo` after PreCodegen
|
||||
|
||||
fn foo(_1: u8) -> () {
|
||||
debug x => _1; // in scope 0 at $DIR/aggregate.rs:+0:8: +0:9
|
||||
let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:15: +0:15
|
||||
let _2: i32; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:14
|
||||
let mut _3: i32; // in scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
let mut _4: (i32, u8); // in scope 0 at $DIR/aggregate.rs:+2:17: +2:23
|
||||
let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:21: +2:22
|
||||
let mut _7: i32; // in scope 0 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
let mut _8: (u8, i32); // in scope 0 at $DIR/aggregate.rs:+3:18: +3:24
|
||||
let mut _9: u8; // in scope 0 at $DIR/aggregate.rs:+3:19: +3:20
|
||||
scope 1 {
|
||||
debug first => _2; // in scope 1 at $DIR/aggregate.rs:+2:9: +2:14
|
||||
let _6: i32; // in scope 1 at $DIR/aggregate.rs:+3:9: +3:15
|
||||
scope 2 {
|
||||
debug second => _6; // in scope 2 at $DIR/aggregate.rs:+3:9: +3:15
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+2:9: +2:14
|
||||
StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
StorageLive(_4); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
|
||||
StorageLive(_5); // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
|
||||
_5 = _1; // scope 0 at $DIR/aggregate.rs:+2:21: +2:22
|
||||
_4 = (const 0_i32, move _5); // scope 0 at $DIR/aggregate.rs:+2:17: +2:23
|
||||
StorageDead(_5); // scope 0 at $DIR/aggregate.rs:+2:22: +2:23
|
||||
_3 = const 0_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:25
|
||||
_2 = const 1_i32; // scope 0 at $DIR/aggregate.rs:+2:17: +2:29
|
||||
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+2:28: +2:29
|
||||
StorageDead(_4); // scope 0 at $DIR/aggregate.rs:+2:29: +2:30
|
||||
StorageLive(_6); // scope 1 at $DIR/aggregate.rs:+3:9: +3:15
|
||||
StorageLive(_7); // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
StorageLive(_8); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
|
||||
StorageLive(_9); // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
|
||||
_9 = _1; // scope 1 at $DIR/aggregate.rs:+3:19: +3:20
|
||||
_8 = (move _9, const 1_i32); // scope 1 at $DIR/aggregate.rs:+3:18: +3:24
|
||||
StorageDead(_9); // scope 1 at $DIR/aggregate.rs:+3:23: +3:24
|
||||
_7 = const 1_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:26
|
||||
_6 = const 3_i32; // scope 1 at $DIR/aggregate.rs:+3:18: +3:30
|
||||
StorageDead(_7); // scope 1 at $DIR/aggregate.rs:+3:29: +3:30
|
||||
StorageDead(_8); // scope 1 at $DIR/aggregate.rs:+3:30: +3:31
|
||||
_0 = const (); // scope 0 at $DIR/aggregate.rs:+0:15: +4:2
|
||||
StorageDead(_6); // scope 1 at $DIR/aggregate.rs:+4:1: +4:2
|
||||
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/aggregate.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
let mut _3: (i32, u8, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
let _4: (); // in scope 0 at $DIR/aggregate.rs:+2:5: +2:11
|
||||
let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
_3 = (const 0_i32, const 1_u8, const 2_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
- _2 = (_3.1: u8); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
- _1 = Add(move _2, const 0_u8); // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
|
||||
+ _2 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
+ _1 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
|
||||
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28
|
||||
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29
|
||||
StorageLive(_4); // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
|
||||
StorageLive(_5); // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
- _5 = _1; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
+ _5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
_4 = foo(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
|
||||
// mir::Constant
|
||||
// + span: $DIR/aggregate.rs:9:5: 9:8
|
||||
// + literal: Const { ty: fn(u8) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_5); // scope 1 at $DIR/aggregate.rs:+2:10: +2:11
|
||||
StorageDead(_4); // scope 1 at $DIR/aggregate.rs:+2:11: +2:12
|
||||
_0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/aggregate.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// MIR for `main` after PreCodegen
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
let mut _3: (i32, u8, i32); // in scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
let _4: (); // in scope 0 at $DIR/aggregate.rs:+2:5: +2:11
|
||||
let mut _5: u8; // in scope 0 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/aggregate.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
StorageLive(_3); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
_3 = (const 0_i32, const 1_u8, const 2_i32); // scope 0 at $DIR/aggregate.rs:+1:13: +1:22
|
||||
_2 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:24
|
||||
_1 = const 1_u8; // scope 0 at $DIR/aggregate.rs:+1:13: +1:28
|
||||
StorageDead(_2); // scope 0 at $DIR/aggregate.rs:+1:27: +1:28
|
||||
StorageDead(_3); // scope 0 at $DIR/aggregate.rs:+1:28: +1:29
|
||||
StorageLive(_4); // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
|
||||
StorageLive(_5); // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
_5 = const 1_u8; // scope 1 at $DIR/aggregate.rs:+2:9: +2:10
|
||||
_4 = foo(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/aggregate.rs:+2:5: +2:11
|
||||
// mir::Constant
|
||||
// + span: $DIR/aggregate.rs:9:5: 9:8
|
||||
// + literal: Const { ty: fn(u8) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_5); // scope 1 at $DIR/aggregate.rs:+2:10: +2:11
|
||||
StorageDead(_4); // scope 1 at $DIR/aggregate.rs:+2:11: +2:12
|
||||
_0 = const (); // scope 0 at $DIR/aggregate.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/aggregate.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/aggregate.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -O
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
let _3: usize; // in scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/array_index.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
_2 = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; // scope 0 at $DIR/array_index.rs:+1:18: +1:30
|
||||
StorageLive(_3); // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:+1:31: +1:32
|
||||
- _4 = Len(_2); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _4 = const 4_usize; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _5 = const true; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = _2[_3]; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
+ _1 = const 2_u32; // scope 0 at $DIR/array_index.rs:+1:18: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
StorageDead(_2); // scope 0 at $DIR/array_index.rs:+1:33: +1:34
|
||||
_0 = const (); // scope 0 at $DIR/array_index.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/array_index.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/array_index.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
let mut _4: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
let mut _5: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
let mut _6: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
let mut _7: bool; // in scope 0 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
scope 1 {
|
||||
debug y => _1; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
|
||||
let _2: i32; // in scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
|
||||
scope 2 {
|
||||
debug _z => _2; // in scope 2 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:9: +1:10
|
||||
_1 = const 0_i32; // scope 0 at $DIR/bad_op_div_by_zero.rs:+1:13: +1:14
|
||||
StorageLive(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:9: +2:11
|
||||
StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_2 = Div(const 1_i32, move _3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:14: +2:19
|
||||
StorageDead(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:+2:18: +2:19
|
||||
_0 = const (); // scope 0 at $DIR/bad_op_div_by_zero.rs:+0:11: +3:2
|
||||
StorageDead(_2); // scope 1 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/bad_op_div_by_zero.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
let mut _4: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
let mut _5: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
let mut _6: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
let mut _7: bool; // in scope 0 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
scope 1 {
|
||||
debug y => _1; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
|
||||
let _2: i32; // in scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
|
||||
scope 2 {
|
||||
debug _z => _2; // in scope 2 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
|
||||
_1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14
|
||||
StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
|
||||
StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
|
||||
StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
|
||||
_0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2
|
||||
StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// unit-test: ConstProp
|
||||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11
|
||||
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
|
||||
let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
scope 2 {
|
||||
let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
scope 3 {
|
||||
debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
// mir::Constant
|
||||
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35
|
||||
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
|
||||
StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
|
||||
StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
|
||||
_0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
|
||||
StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+0:11: +0:11
|
||||
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
|
||||
let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
scope 2 {
|
||||
let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
scope 3 {
|
||||
debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
// mir::Constant
|
||||
// + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35
|
||||
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
|
||||
_3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
_1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
|
||||
StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
|
||||
StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
|
||||
StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
|
||||
StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
|
||||
_7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
+ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
|
||||
StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
|
||||
_0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
|
||||
StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
|
||||
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// unit-test: ConstProp
|
||||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/boxes.rs:+1:9: +1:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/boxes.rs:+1:13: +2:18
|
||||
let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
let mut _4: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
let mut _5: usize; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
let mut _8: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
let mut _9: *const i32; // in scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/boxes.rs:+1:9: +1:10
|
||||
}
|
||||
scope 2 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/boxes.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/boxes.rs:+1:13: +2:18
|
||||
StorageLive(_3); // scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18
|
||||
- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:+1:14: +2:18
|
||||
+ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18
|
||||
+ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:+1:14: +2:18
|
||||
_6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $DIR/boxes.rs:+1:14: +2:18
|
||||
// mir::Constant
|
||||
// + span: $DIR/boxes.rs:13:14: 14:18
|
||||
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_7); // scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
_7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
_8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:+2:14: +2:16
|
||||
(*_8) = const 42_i32; // scope 0 at $DIR/boxes.rs:+2:14: +2:16
|
||||
_3 = move _7; // scope 0 at $DIR/boxes.rs:+1:14: +2:18
|
||||
StorageDead(_7); // scope 0 at $DIR/boxes.rs:+2:17: +2:18
|
||||
_9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); // scope 0 at $DIR/boxes.rs:+1:13: +2:18
|
||||
_2 = (*_9); // scope 0 at $DIR/boxes.rs:+1:13: +2:18
|
||||
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:+1:13: +3:12
|
||||
StorageDead(_2); // scope 0 at $DIR/boxes.rs:+3:11: +3:12
|
||||
drop(_3) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/boxes.rs:+3:12: +3:13
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_3); // scope 0 at $DIR/boxes.rs:+3:12: +3:13
|
||||
_0 = const (); // scope 0 at $DIR/boxes.rs:+0:11: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/boxes.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/boxes.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
// unit-test: ConstProp
|
||||
// compile-flags: -O
|
||||
// ignore-emscripten compiled with panic=abort by default
|
||||
// ignore-wasm32
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// ignore-wasm64
|
||||
|
||||
#![feature(rustc_attrs, stmt_expr_attributes)]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/checked_add.rs:+1:9: +1:10
|
||||
let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/checked_add.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/checked_add.rs:+1:9: +1:10
|
||||
- _2 = CheckedAdd(const 1_u32, const 1_u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
+ _2 = const (2_u32, false); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_2.0: u32); // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
+ _1 = const 2_u32; // scope 0 at $DIR/checked_add.rs:+1:18: +1:23
|
||||
_0 = const (); // scope 0 at $DIR/checked_add.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/checked_add.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/checked_add.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +0:11
|
||||
let _1: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
|
||||
let mut _2: *const i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30
|
||||
let _3: &i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
let _4: (); // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
|
||||
let mut _5: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:9: +2:10
|
||||
StorageLive(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:30
|
||||
StorageLive(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
_3 = const _; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:9:13: 9:16
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(FOO, [], None) }
|
||||
_2 = &raw const (*_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:16
|
||||
_1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:13: +2:39
|
||||
StorageDead(_2); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:38: +2:39
|
||||
StorageDead(_3); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+2:39: +2:40
|
||||
StorageLive(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
|
||||
StorageLive(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
|
||||
_5 = _1; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:10: +3:11
|
||||
_4 = read(move _5) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:5: +3:12
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:10:5: 10:9
|
||||
// + literal: Const { ty: fn(usize) {read}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_5); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:11: +3:12
|
||||
StorageDead(_4); // scope 1 at $DIR/const_prop_fails_gracefully.rs:+3:12: +3:13
|
||||
_0 = const (); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+0:11: +4:2
|
||||
StorageDead(_1); // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:1: +4:2
|
||||
return; // scope 0 at $DIR/const_prop_fails_gracefully.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
#[inline(never)]
|
||||
fn read(_: usize) { }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
- // MIR for `hello` before ConstProp
|
||||
+ // MIR for `hello` after ConstProp
|
||||
|
||||
fn hello() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/control_flow_simplification.rs:+0:14: +0:14
|
||||
let mut _1: bool; // in scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
_1 = const _; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
- switchInt(move _1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
+ switchInt(const false) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
// + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
// + literal: Const { ty: &str, val: Value(Slice(..)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_1); // scope 0 at $DIR/control_flow_simplification.rs:+3:5: +3:6
|
||||
return; // scope 0 at $DIR/control_flow_simplification.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// MIR for `hello` before PreCodegen
|
||||
|
||||
fn hello() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/control_flow_simplification.rs:+0:14: +0:14
|
||||
|
||||
bb0: {
|
||||
return; // scope 0 at $DIR/control_flow_simplification.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -Zmir-opt-level=1
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/indirect.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/indirect.rs:+1:9: +1:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
let mut _3: (u8, bool); // in scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/indirect.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/indirect.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
- _2 = const 2_u32 as u8 (IntToInt); // scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
- _3 = CheckedAdd(_2, const 1_u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
+ _2 = const 2_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:25
|
||||
+ _3 = const (3_u8, false); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_3.0: u8); // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
+ _1 = const 3_u8; // scope 0 at $DIR/indirect.rs:+1:13: +1:29
|
||||
StorageDead(_2); // scope 0 at $DIR/indirect.rs:+1:28: +1:29
|
||||
_0 = const (); // scope 0 at $DIR/indirect.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/indirect.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/indirect.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/inherit_overflow.rs:+0:11: +0:11
|
||||
let mut _1: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
let mut _2: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
let mut _3: u8; // in scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
scope 1 {
|
||||
}
|
||||
scope 2 (inlined <u8 as Add>::add) { // at $DIR/inherit_overflow.rs:9:13: 9:47
|
||||
debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageLive(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
_2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
_3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
- _4 = CheckedAdd(_2, _3); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
+ _4 = const (0_u8, true); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
+ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
||||
StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
|
||||
StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48
|
||||
_0 = const (); // scope 0 at $DIR/inherit_overflow.rs:+0:11: +4:2
|
||||
return; // scope 0 at $DIR/inherit_overflow.rs:+4:2: +4:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -Zmir-enable-passes=+Inline
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue_66971.rs:+0:11: +0:11
|
||||
let _1: (); // in scope 0 at $DIR/issue_66971.rs:+1:5: +1:23
|
||||
let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue_66971.rs:+1:12: +1:22
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22
|
||||
_2 = (const (), const 0_u8, const 0_u8); // scope 0 at $DIR/issue_66971.rs:+1:12: +1:22
|
||||
_1 = encode(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_66971.rs:+1:5: +1:23
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue_66971.rs:18:5: 18:11
|
||||
// + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_2); // scope 0 at $DIR/issue_66971.rs:+1:22: +1:23
|
||||
return; // scope 0 at $DIR/issue_66971.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue_67019.rs:+0:11: +0:11
|
||||
let _1: (); // in scope 0 at $DIR/issue_67019.rs:+1:5: +1:20
|
||||
let mut _2: ((u8, u8),); // in scope 0 at $DIR/issue_67019.rs:+1:10: +1:19
|
||||
let mut _3: (u8, u8); // in scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19
|
||||
StorageLive(_3); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
|
||||
- _3 = (const 1_u8, const 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
|
||||
+ _3 = const (1_u8, 2_u8); // scope 0 at $DIR/issue_67019.rs:+1:11: +1:17
|
||||
_2 = (move _3,); // scope 0 at $DIR/issue_67019.rs:+1:10: +1:19
|
||||
StorageDead(_3); // scope 0 at $DIR/issue_67019.rs:+1:18: +1:19
|
||||
_1 = test(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/issue_67019.rs:+1:5: +1:20
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue_67019.rs:13:5: 13:9
|
||||
// + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_2); // scope 0 at $DIR/issue_67019.rs:+1:19: +1:20
|
||||
return; // scope 0 at $DIR/issue_67019.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
_2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
_3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
_0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/large_array_index.rs:+0:11: +0:11
|
||||
let _1: u8; // in scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
let mut _2: [u8; 5000]; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
let _3: usize; // in scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
let mut _4: usize; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
let mut _5: bool; // in scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/large_array_index.rs:+2:9: +2:10
|
||||
StorageLive(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
_2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
|
||||
StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
_3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
|
||||
- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
+ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
|
||||
StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
|
||||
_0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// unit-test: ConstProp
|
||||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +0:11
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
|
||||
let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
|
||||
_1 = foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32
|
||||
// + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
(_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+2:5: +2:13
|
||||
(_1.0: i32) = const 42_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+3:5: +3:13
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
|
||||
- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
|
||||
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11
|
||||
let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
|
||||
let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
|
||||
scope 2 {
|
||||
debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
|
||||
let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
|
||||
scope 3 {
|
||||
debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
|
||||
let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
|
||||
scope 4 {
|
||||
debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
|
||||
_1 = foo() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_unprop_assign.rs:6:13: 6:16
|
||||
// + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
|
||||
- _2 = (const 1_i32, const 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
|
||||
+ _2 = const (1_i32, 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
_3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
(_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
|
||||
StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
|
||||
_4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16
|
||||
StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
|
||||
- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
|
||||
+ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2
|
||||
StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
|
||||
return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// unit-test: ConstProp
|
||||
|
||||
// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
_3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
_4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32
|
||||
+ _2 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32
|
||||
StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
|
||||
StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
_0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
let _4: usize; // in scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/repeat.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/repeat.rs:+1:9: +1:10
|
||||
StorageLive(_2); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
StorageLive(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
_3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
|
||||
StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
_4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
|
||||
- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _2 = _3[_4]; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
- _1 = Add(move _2, const 0_u32); // scope 0 at $DIR/repeat.rs:+1:18: +1:32
|
||||
+ _2 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
|
||||
+ _1 = const 42_u32; // scope 0 at $DIR/repeat.rs:+1:18: +1:32
|
||||
StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
|
||||
StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
|
||||
_0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
|
||||
StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
|
||||
return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// unit-test: ConstProp
|
||||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
- // MIR for `add` before ConstProp
|
||||
+ // MIR for `add` after ConstProp
|
||||
|
||||
fn add() -> u32 {
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
|
||||
let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
|
||||
bb0: {
|
||||
- _1 = CheckedAdd(const 2_u32, const 2_u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
+ _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _0 = move (_1.0: u32); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
+ _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// MIR for `add` before PreCodegen
|
||||
|
||||
fn add() -> u32 {
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
|
||||
let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
|
||||
bb0: {
|
||||
_1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind unreachable]; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
|
||||
return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// unit-test: ConstProp
|
||||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR return_place.add.ConstProp.diff
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +0:11
|
||||
let _1: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
|
||||
let _2: (); // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
let mut _3: u32; // in scope 0 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
|
||||
_1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14
|
||||
StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
+ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
|
||||
_2 = consume(move _3) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
|
||||
// mir::Constant
|
||||
// + span: $DIR/scalar_literal_propagation.rs:6:5: 6:12
|
||||
// + literal: Const { ty: fn(u32) {consume}, val: Value(<ZST>) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15
|
||||
StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16
|
||||
_0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2
|
||||
StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2
|
||||
return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue