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.
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
Nop
s:
This is the implementation of the pass which transforms coroutines into state machines.
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.
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.
Global value numbering.
Inlining pass for MIR functions.
Performs various peephole optimizations.
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.
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.
Lowers intrinsic calls
This pass lowers calls to core::slice::len to just PtrMetadata op.
It should run before inlining!
This pass removes jumps to basic blocks containing only a return, and replaces them with a
return instead.
These two passes provide no value to the compiler, so are off at every level.
A pass that promotes borrows of constant rvalues.
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.
Removes operations on ZST places, and convert ZST operands to constants.
Normalizes MIR in RevealAll mode.
A number of passes which remove various redundancies in the CFG.
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.
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.
Validates the MIR to ensure that invariants are upheld.