Crate rustc_mir_transform

source Β·


  • add_call_guards πŸ”’
  • add_retag πŸ”’
    This pass adds validation calls (AcquireValid, ReleaseValid) where appropriate. It has to be run really early, before transformations like inlining, because introducing these calls adds UB – so, conceptually, this pass is actually part of MIR building, and only after this pass we think of the program has having the normal MIR semantics.
  • check_alignment πŸ”’
  • check_packed_ref πŸ”’
  • This module provides a pass that removes parts of MIR that are no longer relevant after analysis phase and borrowck. In particular, it removes false edges, user type annotations and replaces following statements with Nops:
  • copy_prop πŸ”’
  • coroutine πŸ”’
    This is the implementation of the pass which transforms coroutines into state machines.
  • cost_checker πŸ”’
  • coverage πŸ”’
  • ctfe_limit πŸ”’
    A pass that inserts the ConstEvalCounter instruction into any blocks that have a back edge (thus indicating there is a loop in the CFG), or whose terminator is a function call.
  • A constant propagation optimization pass based on dataflow analysis.
  • This module implements a dead store elimination (DSE) routine.
  • Deduces supplementary parameter attributes from MIR.
  • This pass finds basic blocks that are completely equal, and replaces all uses with just one of them.
  • deref_separator πŸ”’
  • dest_prop πŸ”’
    Propagates assignment destinations backwards in the CFG to eliminate redundant assignments.
  • This pass just dumps MIR at a specified point.
  • This pass transforms derefs of Box into a deref of the pointer inside Box.
  • elaborate_drops πŸ”’
  • errors πŸ”’
  • ffi_unwind_calls πŸ”’
  • gvn πŸ”’
    Global value numbering.
  • Inlining pass for MIR functions.
  • instsimplify πŸ”’
    Performs various peephole optimizations.
  • jump_threading πŸ”’
    A jump threading optimization.
  • A lint that checks for known panics like overflows, division by zero, out-of-bound access etc. Uses const propagation to determine the values of operands during checks.
  • large_enums πŸ”’
  • lint πŸ”’
    This pass statically detects code which has undefined behaviour or is likely to be erroneous. It can be used to locate problems in MIR building or optimizations. It assumes that all code can be executed, so it has false positives.
  • lower_intrinsics πŸ”’
    Lowers intrinsic calls
  • lower_slice_len πŸ”’
    This pass lowers calls to core::slice::len to just Len op. It should run before inlining!
  • match_branches πŸ”’
  • mentioned_items πŸ”’
  • This pass removes jumps to basic blocks containing only a return, and replaces them with a return instead.
  • This pass eliminates casting of arrays into slices when their length is taken using .len() method. Handy to preserve information in MIR for const prop
  • nrvo πŸ”’
    See the docs for RenameReturnPlace.
  • pass_manager πŸ”’
  • prettify πŸ”’
    These two passes provide no value to the compiler, so are off at every level.
  • promote_consts πŸ”’
    A pass that promotes borrows of constant rvalues.
  • ref_prop πŸ”’
  • This pass removes PlaceMention statement, which has no effect at codegen.
  • This pass removes storage markers if they won’t be emitted during codegen.
  • This pass replaces a drop of a type that does not need dropping, with a goto.
  • remove_zsts πŸ”’
    Removes operations on ZST places, and convert ZST operands to constants.
  • required_consts πŸ”’
  • reveal_all πŸ”’
    Normalizes MIR in RevealAll mode.
  • shim πŸ”’
  • A number of passes which remove various redundancies in the CFG.
  • sroa πŸ”’
  • ssa πŸ”’
    We denote as β€œSSA” the set of locals that verify the following properties: 1/ They are only assigned-to once, either as a function parameter, or in an assign statement; 2/ This single assignment dominates all uses;
  • A pass that eliminates branches on uninhabited or unreachable enum variants.
  • unreachable_prop πŸ”’
    A pass that propagates the unreachable terminator of a block to its predecessors when all of their successors are unreachable. This is achieved through a post-order traversal of the blocks.
  • validate πŸ”’
    Validates the MIR to ensure that invariants are upheld.


  • Raw content of Fluent resource for this crate, generated by fluent_messages macro, imported by rustc_driver to include all crates’ resources in one bundle.