Skip to content

Commit 7a9661d

Browse files
Disable non-required MIR opts with optimize(none)
Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>
1 parent cd848c9 commit 7a9661d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+319
-10
lines changed

compiler/rustc_attr_data_structures/src/attributes.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ pub enum OptimizeAttr {
4646
Size,
4747
}
4848

49+
impl OptimizeAttr {
50+
pub fn do_not_optimize(&self) -> bool {
51+
matches!(self, Self::DoNotOptimize)
52+
}
53+
}
54+
4955
#[derive(Clone, Debug, Encodable, Decodable)]
5056
pub enum DiagnosticAttribute {
5157
// tidy-alphabetical-start

compiler/rustc_mir_transform/src/abort_unwinding_calls.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,8 @@ impl<'tcx> crate::MirPass<'tcx> for AbortUnwindingCalls {
116116
// We may have invalidated some `cleanup` blocks so clean those up now.
117117
super::simplify::remove_dead_blocks(body);
118118
}
119+
120+
fn is_required(&self) -> bool {
121+
true
122+
}
119123
}

compiler/rustc_mir_transform/src/add_call_guards.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ impl<'tcx> crate::MirPass<'tcx> for AddCallGuards {
7575

7676
body.basic_blocks_mut().extend(new_blocks);
7777
}
78+
79+
fn is_required(&self) -> bool {
80+
true
81+
}
7882
}

compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ impl<'tcx> crate::MirPass<'tcx> for AddMovesForPackedDrops {
6868

6969
patch.apply(body);
7070
}
71+
72+
fn is_required(&self) -> bool {
73+
true
74+
}
7175
}
7276

7377
fn add_move_for_packed_drop<'tcx>(

compiler/rustc_mir_transform/src/add_retag.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,8 @@ impl<'tcx> crate::MirPass<'tcx> for AddRetag {
176176
}
177177
}
178178
}
179+
180+
fn is_required(&self) -> bool {
181+
true
182+
}
179183
}

compiler/rustc_mir_transform/src/add_subtyping_projections.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ impl<'tcx> crate::MirPass<'tcx> for Subtyper {
6161
}
6262
checker.patcher.apply(body);
6363
}
64+
65+
fn is_required(&self) -> bool {
66+
true
67+
}
6468
}

compiler/rustc_mir_transform/src/check_alignment.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ impl<'tcx> crate::MirPass<'tcx> for CheckAlignment {
6060
}
6161
}
6262
}
63+
64+
fn is_required(&self) -> bool {
65+
true
66+
}
6367
}
6468

6569
struct PointerFinder<'a, 'tcx> {

compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,8 @@ impl<'tcx> crate::MirPass<'tcx> for CleanupPostBorrowck {
7272
decl.user_ty = None;
7373
}
7474
}
75+
76+
fn is_required(&self) -> bool {
77+
true
78+
}
7579
}

compiler/rustc_mir_transform/src/copy_prop.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ impl<'tcx> crate::MirPass<'tcx> for CopyProp {
5656
crate::simplify::remove_unused_definitions(body);
5757
}
5858
}
59+
60+
fn is_required(&self) -> bool {
61+
false
62+
}
5963
}
6064

6165
/// `SsaLocals` computed equivalence classes between locals considering copy/move assignments.

compiler/rustc_mir_transform/src/coroutine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,10 @@ impl<'tcx> crate::MirPass<'tcx> for StateTransform {
16881688
// Run derefer to fix Derefs that are not in the first place
16891689
deref_finder(tcx, body);
16901690
}
1691+
1692+
fn is_required(&self) -> bool {
1693+
true
1694+
}
16911695
}
16921696

16931697
/// Looks for any assignments between locals (e.g., `_4 = _5`) that will both be converted to fields

0 commit comments

Comments
 (0)