Rollup merge of #82736 - spastorino:mir-opt-level-perf-changes, r=oli-obk
Bump optimization from mir_opt_level 2 to 3 and 3 to 4 and make "release" be level 2 by default r? `@oli-obk`
This commit is contained in:
commit
15c148b4f2
|
@ -566,7 +566,7 @@ fn test_debugging_options_tracking_hash() {
|
|||
tracked!(link_only, true);
|
||||
tracked!(merge_functions, Some(MergeFunctions::Disabled));
|
||||
tracked!(mir_emit_retag, true);
|
||||
tracked!(mir_opt_level, 3);
|
||||
tracked!(mir_opt_level, Some(4));
|
||||
tracked!(mutable_noalias, true);
|
||||
tracked!(new_llvm_pass_manager, true);
|
||||
tracked!(no_codegen, true);
|
||||
|
|
|
@ -28,7 +28,7 @@ pub struct ConstGoto;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for ConstGoto {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
||||
if tcx.sess.mir_opt_level() < 4 {
|
||||
return;
|
||||
}
|
||||
trace!("Running ConstGoto on {:?}", body.source);
|
||||
|
|
|
@ -725,7 +725,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
return None;
|
||||
}
|
||||
|
||||
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 3 {
|
||||
if self.tcx.sess.mir_opt_level() >= 4 {
|
||||
self.eval_rvalue_with_identities(rvalue, place)
|
||||
} else {
|
||||
self.use_ecx(|this| this.ecx.eval_rvalue_into_place(rvalue, place))
|
||||
|
@ -903,7 +903,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
|
||||
/// Returns `true` if and only if this `op` should be const-propagated into.
|
||||
fn should_const_prop(&mut self, op: &OpTy<'tcx>) -> bool {
|
||||
let mir_opt_level = self.tcx.sess.opts.debugging_opts.mir_opt_level;
|
||||
let mir_opt_level = self.tcx.sess.mir_opt_level();
|
||||
|
||||
if mir_opt_level == 0 {
|
||||
return false;
|
||||
|
@ -1071,9 +1071,9 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
|||
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
|
||||
self.super_operand(operand, location);
|
||||
|
||||
// Only const prop copies and moves on `mir_opt_level=2` as doing so
|
||||
// Only const prop copies and moves on `mir_opt_level=3` as doing so
|
||||
// currently slightly increases compile time in some cases.
|
||||
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 2 {
|
||||
if self.tcx.sess.mir_opt_level() >= 3 {
|
||||
self.propagate_operand(operand)
|
||||
}
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
|||
TerminatorKind::SwitchInt { ref mut discr, .. } => {
|
||||
// FIXME: This is currently redundant with `visit_operand`, but sadly
|
||||
// always visiting operands currently causes a perf regression in LLVM codegen, so
|
||||
// `visit_operand` currently only runs for propagates places for `mir_opt_level=3`.
|
||||
// `visit_operand` currently only runs for propagates places for `mir_opt_level=4`.
|
||||
self.propagate_operand(discr)
|
||||
}
|
||||
// None of these have Operands to const-propagate.
|
||||
|
@ -1272,7 +1272,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
|||
// Every argument in our function calls have already been propagated in `visit_operand`.
|
||||
//
|
||||
// NOTE: because LLVM codegen gives slight performance regressions with it, so this is
|
||||
// gated on `mir_opt_level=2`.
|
||||
// gated on `mir_opt_level=3`.
|
||||
TerminatorKind::Call { .. } => {}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct DeduplicateBlocks;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for DeduplicateBlocks {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
||||
if tcx.sess.mir_opt_level() < 4 {
|
||||
return;
|
||||
}
|
||||
debug!("Running DeduplicateBlocks on `{:?}`", body.source);
|
||||
|
|
|
@ -127,9 +127,9 @@ pub struct DestinationPropagation;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for DestinationPropagation {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
// Only run at mir-opt-level=2 or higher for now (we don't fix up debuginfo and remove
|
||||
// Only run at mir-opt-level=3 or higher for now (we don't fix up debuginfo and remove
|
||||
// storage statements at the moment).
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 {
|
||||
if tcx.sess.mir_opt_level() < 3 {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ pub struct EarlyOtherwiseBranch;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 2 {
|
||||
if tcx.sess.mir_opt_level() < 3 {
|
||||
return;
|
||||
}
|
||||
trace!("running EarlyOtherwiseBranch on {:?}", body.source);
|
||||
|
|
|
@ -52,7 +52,7 @@ crate fn is_enabled(tcx: TyCtxt<'_>) -> bool {
|
|||
return enabled;
|
||||
}
|
||||
|
||||
tcx.sess.opts.debugging_opts.mir_opt_level >= 2
|
||||
tcx.sess.mir_opt_level() >= 3
|
||||
}
|
||||
|
||||
impl<'tcx> MirPass<'tcx> for Inline {
|
||||
|
|
|
@ -40,7 +40,7 @@ pub struct MatchBranchSimplification;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 {
|
||||
if tcx.sess.mir_opt_level() < 3 {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc
|
|||
}
|
||||
|
||||
fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
let mir_opt_level = tcx.sess.opts.debugging_opts.mir_opt_level;
|
||||
let mir_opt_level = tcx.sess.mir_opt_level();
|
||||
|
||||
// Lowering generator control-flow and variables has to happen before we do anything else
|
||||
// to them. We run some optimizations before that, because they may be harder to do on the state
|
||||
|
|
|
@ -10,7 +10,7 @@ pub struct MultipleReturnTerminators;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
||||
if tcx.sess.mir_opt_level() < 4 {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ pub struct RenameReturnPlace;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {
|
||||
if tcx.sess.mir_opt_level() == 0 {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ pub struct UnreachablePropagation;
|
|||
|
||||
impl MirPass<'_> for UnreachablePropagation {
|
||||
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
||||
// Enable only under -Zmir-opt-level=3 as in some cases (check the deeply-nested-opt
|
||||
if tcx.sess.mir_opt_level() < 4 {
|
||||
// Enable only under -Zmir-opt-level=4 as in some cases (check the deeply-nested-opt
|
||||
// perf benchmark) LLVM may spend quite a lot of time optimizing the generated code.
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1938,21 +1938,23 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
|||
Some(SymbolManglingVersion::V0) => {}
|
||||
}
|
||||
|
||||
if debugging_opts.mir_opt_level > 1 {
|
||||
// Functions inlined during MIR transform can, at best, make it impossible to
|
||||
// effectively cover inlined functions, and, at worst, break coverage map generation
|
||||
// during LLVM codegen. For example, function counter IDs are only unique within a
|
||||
// function. Inlining after these counters are injected can produce duplicate counters,
|
||||
// resulting in an invalid coverage map (and ICE); so this option combination is not
|
||||
// allowed.
|
||||
early_warn(
|
||||
error_format,
|
||||
&format!(
|
||||
"`-Z mir-opt-level={}` (or any level > 1) enables function inlining, which \
|
||||
if let Some(mir_opt_level) = debugging_opts.mir_opt_level {
|
||||
if mir_opt_level > 1 {
|
||||
// Functions inlined during MIR transform can, at best, make it impossible to
|
||||
// effectively cover inlined functions, and, at worst, break coverage map generation
|
||||
// during LLVM codegen. For example, function counter IDs are only unique within a
|
||||
// function. Inlining after these counters are injected can produce duplicate counters,
|
||||
// resulting in an invalid coverage map (and ICE); so this option combination is not
|
||||
// allowed.
|
||||
early_warn(
|
||||
error_format,
|
||||
&format!(
|
||||
"`-Z mir-opt-level={}` (or any level > 1) enables function inlining, which \
|
||||
is incompatible with `-Z instrument-coverage`. Inlining will be disabled.",
|
||||
debugging_opts.mir_opt_level,
|
||||
),
|
||||
);
|
||||
mir_opt_level,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -999,8 +999,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
|
||||
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
|
||||
(default: no)"),
|
||||
mir_opt_level: usize = (1, parse_uint, [TRACKED],
|
||||
"MIR optimization level (0-3; default: 1)"),
|
||||
mir_opt_level: Option<usize> = (None, parse_opt_uint, [TRACKED],
|
||||
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
|
||||
mutable_noalias: bool = (false, parse_bool, [TRACKED],
|
||||
"emit noalias metadata for mutable references (default: no)"),
|
||||
new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED],
|
||||
|
|
|
@ -640,6 +640,12 @@ impl Session {
|
|||
pub fn binary_dep_depinfo(&self) -> bool {
|
||||
self.opts.debugging_opts.binary_dep_depinfo
|
||||
}
|
||||
pub fn mir_opt_level(&self) -> usize {
|
||||
self.opts
|
||||
.debugging_opts
|
||||
.mir_opt_level
|
||||
.unwrap_or_else(|| if self.opts.optimize != config::OptLevel::No { 2 } else { 1 })
|
||||
}
|
||||
|
||||
/// Gets the features enabled for the current compilation session.
|
||||
/// DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
// Once the optimizer can do that, mir-opt/issues/issue-59352.rs will need to be updated and this
|
||||
// test case should be removed as it will become redundant.
|
||||
|
||||
// mir-opt-level=2 enables inlining and enables LLVM to optimize away the unreachable panic call.
|
||||
// compile-flags: -O -Z mir-opt-level=2
|
||||
// mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call.
|
||||
// compile-flags: -O -Z mir-opt-level=3
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Checks that naked functions are never inlined.
|
||||
// compile-flags: -O -Zmir-opt-level=2
|
||||
// compile-flags: -O -Zmir-opt-level=3
|
||||
// ignore-wasm32
|
||||
#![crate_type = "lib"]
|
||||
#![feature(asm)]
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
// needs-sanitizer-address
|
||||
// needs-sanitizer-leak
|
||||
// revisions: ASAN LSAN
|
||||
//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=3
|
||||
//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=3
|
||||
//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=4
|
||||
//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=4
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![feature(no_sanitize)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=2 -Zunsound-mir-opts
|
||||
// compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=3 -Zunsound-mir-opts
|
||||
|
||||
// Ensure that `x?` has no overhead on `Result<T, E>` due to identity `match`es in lowering.
|
||||
// This requires inlining to trigger the MIR optimizations in `SimplifyArmIdentity`.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -O -Zmir-opt-level=3
|
||||
// compile-flags: -O -Zmir-opt-level=4
|
||||
|
||||
// EMIT_MIR boolean_identities.test.ConstProp.diff
|
||||
pub fn test(x: bool, y: bool) -> bool {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
|
||||
// outputs below, after ConstProp this is how _2 would look like with the bug:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
// This used to ICE in const-prop
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -O -Zmir-opt-level=3
|
||||
// compile-flags: -O -Zmir-opt-level=4
|
||||
|
||||
// EMIT_MIR mult_by_zero.test.ConstProp.diff
|
||||
fn test(x : i32) -> i32 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
|
||||
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
|
||||
match (x, y) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
|
||||
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
|
||||
fn opt1(x: Option<u32>, y: Option<u32>, z: Option<u32>) -> u32 {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// ignore-tidy-linelength
|
||||
// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
|
||||
// compile-flags: -Z mir-opt-level=4 -Zunsound-mir-opts
|
||||
|
||||
// example from #68867
|
||||
type CSSFloat = f32;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
|
||||
// must not optimize as it does not follow the pattern of
|
||||
// left and right hand side being the same variant
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// ignore-endian-big
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
#![feature(box_syntax)]
|
||||
// EMIT_MIR inline_into_box_place.main.Inline.diff
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z span_free_formats -Z mir-opt-level=3
|
||||
// compile-flags: -Z span_free_formats -Z mir-opt-level=4
|
||||
|
||||
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
|
||||
fn test2(x: &dyn X) -> bool {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// removed.
|
||||
|
||||
// EMIT_MIR issue_59352.num_to_digit.PreCodegen.after.mir
|
||||
// compile-flags: -Z mir-opt-level=2 -Z span_free_formats
|
||||
// compile-flags: -Z mir-opt-level=3 -Z span_free_formats
|
||||
|
||||
pub fn num_to_digit(num: char) -> u32 {
|
||||
// CHECK-NOT: panic
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
|
||||
|
||||
fn test(x: bool) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts.
|
||||
// Regression test for issue #66856.
|
||||
//
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
enum Src {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2 -Zunsound-mir-opts
|
||||
// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
|
||||
// EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff
|
||||
// EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff
|
||||
// EMIT_MIR simplify_arm.id_result.SimplifyArmIdentity.diff
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Zmir-opt-level=3
|
||||
// compile-flags: -Zmir-opt-level=4
|
||||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Must be build-pass, because check-pass will not run const prop and thus not emit the lint anyway.
|
||||
// build-pass
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// run-pass
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
|
||||
// Checks that the compiler does not ICE when passing references to field of by-value struct
|
||||
// with -Z mir-opt-level=3
|
||||
// with -Z mir-opt-level=4
|
||||
|
||||
fn do_nothing(_: &()) {}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// run-pass
|
||||
|
||||
struct Baz<T: ?Sized> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
// run-pass
|
||||
|
||||
struct X {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// run-pass
|
||||
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// run-pass
|
||||
|
||||
fn e220() -> (i64, i64) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// ignore-wasm32-bare which doesn't support `std::process:exit()`
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
// run-pass
|
||||
|
||||
// Tests that specialization does not cause optimizations running on polymorphic MIR to resolve
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
|
||||
trait IterExt: Iterator {
|
||||
fn fold_ex<B, F>(mut self, init: B, mut f: F) -> B
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// elaborate-drops invoked on it) and then try to elaboate drops a
|
||||
// second time. Uncool.
|
||||
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
// compile-flags:-Zmir-opt-level=4
|
||||
// build-pass
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// revisions: default miropt
|
||||
//[miropt]compile-flags: -Z mir-opt-level=2
|
||||
//[miropt]compile-flags: -Z mir-opt-level=3
|
||||
// ~^ This flag is for #77668, it used to be ICE.
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Zmir-opt-level=2 -Copt-level=0
|
||||
// compile-flags: -Zmir-opt-level=3 -Copt-level=0
|
||||
// run-pass
|
||||
|
||||
type M = [i64; 2];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// edition:2018
|
||||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
#[inline(always)]
|
||||
pub fn copy_prop(s: bool) -> String {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// did not check that the types matched up in the `Ok(r)` branch.
|
||||
//
|
||||
// run-pass
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
enum SpecialsRes { Res(u64) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
// build-pass
|
||||
|
||||
// This used to ICE in const-prop due
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// build-pass
|
||||
|
||||
// This used to ICE due to the inling pass not examining projections
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// edition:2018
|
||||
// build-pass
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// check-pass
|
||||
// edition:2018
|
||||
// compile-args: -Zmir-opt-level=2
|
||||
// compile-args: -Zmir-opt-level=3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// build-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Regression test for #76248.
|
||||
//
|
||||
// build-pass
|
||||
// compile-flags: -Zmir-opt-level=2
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
|
||||
const N: usize = 1;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//
|
||||
// edition:2018
|
||||
// build-pass
|
||||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// aux-build:issue_76375_aux.rs
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Regression test for issue #76740.
|
||||
// run-pass
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
// compile-flags: -Zmir-opt-level=4
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct V([usize; 4]);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// build-pass
|
||||
|
||||
use std::fs::File;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags: -Z mir-opt-level=2 -C opt-level=0
|
||||
// compile-flags: -Z mir-opt-level=3 -C opt-level=0
|
||||
|
||||
// example from #78496
|
||||
pub enum E<'a> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// build-pass
|
||||
|
||||
// This used to ICE in const-prop
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Regression test for issue #79269.
|
||||
//
|
||||
// build-pass
|
||||
// compile-flags: -Zmir-opt-level=2 -Zvalidate-mir
|
||||
// compile-flags: -Zmir-opt-level=3 -Zvalidate-mir
|
||||
#[derive(Clone)]
|
||||
struct Array<T, const N: usize>([T; N]);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
|
||||
trait Array {
|
||||
type Item;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
|
||||
pub enum Enum {
|
||||
A,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
pub fn main() {
|
||||
let _x: fn() = handle_debug_column;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
|
||||
// Previously ICEd because we did not normalize during inlining,
|
||||
// see https://github.com/rust-lang/rust/pull/77306 for more discussion.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
|
||||
struct Cursor {}
|
||||
struct TokenTree {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
const N: usize = 2;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Ensures -Zmir-opt-level=2 (specifically, inlining) is not allowed with -Zinstrument-coverage.
|
||||
// Ensures -Zmir-opt-level=3 (specifically, inlining) is not allowed with -Zinstrument-coverage.
|
||||
// Regression test for issue #80060.
|
||||
//
|
||||
// needs-profiler-support
|
||||
// build-pass
|
||||
// compile-flags: -Zmir-opt-level=2 -Zinstrument-coverage
|
||||
// compile-flags: -Zmir-opt-level=3 -Zinstrument-coverage
|
||||
#[inline(never)]
|
||||
fn foo() {}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
warning: `-Z mir-opt-level=2` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.
|
||||
warning: `-Z mir-opt-level=3` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags:-Zmir-opt-level=2
|
||||
// compile-flags:-Zmir-opt-level=3
|
||||
pub trait Foo {
|
||||
fn bar(&self) -> usize { 2 }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags: -Z mir-opt-level=2 -C opt-level=0 -C debuginfo=2
|
||||
// compile-flags: -Z mir-opt-level=3 -C opt-level=0 -C debuginfo=2
|
||||
|
||||
#[inline(never)]
|
||||
pub fn foo(bar: usize) -> usize {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=2
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// build-pass
|
||||
#![crate_type="lib"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// build-pass
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// compile-flags: -Z mir-opt-level=4
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![feature(lang_items)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// run-pass
|
||||
// compile-flags: -Zpolymorphize=on -Zmir-opt-level=3
|
||||
// compile-flags: -Zpolymorphize=on -Zmir-opt-level=4
|
||||
|
||||
fn caller<T, U>() -> &'static usize {
|
||||
callee::<U>()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
#[inline(never)]
|
||||
#[track_caller]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
#![feature(const_caller_location, const_fn)]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
macro_rules! caller_location_from_macro {
|
||||
() => (core::panic::Location::caller());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
#[track_caller]
|
||||
fn f() {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-pass
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
#![feature(option_expect_none, option_unwrap_none)]
|
||||
#![allow(unconditional_panic)]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
use std::panic::Location;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
fn pass_to_ptr_call<T>(f: fn(T), x: T) {
|
||||
f(x);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
// revisions: default mir-opt
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
||||
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||
|
||||
fn ptr_call(f: fn()) {
|
||||
f();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// passed the wrong Instance, causing issues with inlining. See #67557.
|
||||
//
|
||||
// run-pass
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
// compile-flags: -Zmir-opt-level=4
|
||||
#![feature(platform_intrinsics, repr_simd)]
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// the wrong Instance, causing issues with inlining. See #67557.
|
||||
//
|
||||
// run-pass
|
||||
// compile-flags: -Zmir-opt-level=3
|
||||
// compile-flags: -Zmir-opt-level=4
|
||||
#![feature(platform_intrinsics, repr_simd)]
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
|
|
|
@ -83,7 +83,7 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
|
|||
// run on the unoptimized MIR. On the other hand this results in some false negatives. If
|
||||
// MIR passes can be enabled / disabled separately, we should figure out, what passes to
|
||||
// use for Clippy.
|
||||
config.opts.debugging_opts.mir_opt_level = 0;
|
||||
config.opts.debugging_opts.mir_opt_level = Some(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1960,7 +1960,7 @@ impl<'test> TestCx<'test> {
|
|||
rustc.args(&[
|
||||
"-Copt-level=1",
|
||||
"-Zdump-mir=all",
|
||||
"-Zmir-opt-level=3",
|
||||
"-Zmir-opt-level=4",
|
||||
"-Zvalidate-mir",
|
||||
"-Zdump-mir-exclude-pass-number",
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue