compiler: Don't mark SingleUseConsts MIR pass as "required for soundness"
Because: * Something like it did not exist before PR 107404 * That it is not run our mir-opt-level 0 indicates that it is not required for soundness * Its `MirPass::can_be_overridden()` is unchanged and thus returns true, indicating that it is not a required MIR pass. * No test fails in PR 151426 that stops enabling by default in non-optimized builds As can be seen from the updated test `tests/mir-opt/optimize_none.rs`, this means that `#[optimize(none)]` functions become even less optimized. As expected and as desired.
This commit is contained in:
parent
47611e1604
commit
52b19f7dda
2 changed files with 5 additions and 4 deletions
|
|
@ -85,7 +85,7 @@ impl<'tcx> crate::MirPass<'tcx> for SingleUseConsts {
|
|||
}
|
||||
|
||||
fn is_required(&self) -> bool {
|
||||
true
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,14 @@ pub fn add_noopt() -> i32 {
|
|||
#[optimize(none)]
|
||||
pub fn const_branch() -> i32 {
|
||||
// CHECK-LABEL: fn const_branch(
|
||||
// CHECK: switchInt(const true) -> [0: [[FALSE:bb[0-9]+]], otherwise: [[TRUE:bb[0-9]+]]];
|
||||
// CHECK: [[BOOL:_[0-9]+]] = const true;
|
||||
// CHECK: switchInt(move [[BOOL]]) -> [0: [[BB_FALSE:bb[0-9]+]], otherwise: [[BB_TRUE:bb[0-9]+]]];
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: [[FALSE]]: {
|
||||
// CHECK: [[BB_FALSE]]: {
|
||||
// CHECK-NEXT: _0 = const 0
|
||||
// CHECK-NEXT: goto
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: [[TRUE]]: {
|
||||
// CHECK: [[BB_TRUE]]: {
|
||||
// CHECK-NEXT: _0 = const 1
|
||||
// CHECK-NEXT: goto
|
||||
// CHECK-NEXT: }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue