| 1 | //! Optimization passes over IR. |
| 2 | //! |
| 3 | //! Constant folding, DCE, CSE, LICM, inlining, loop optimizations, |
| 4 | //! NEON vectorization, and Fortran-specific optimizations. |
| 5 | //! |
| 6 | //! Passes are run via the `PassManager`. The pipeline used for a given |
| 7 | //! invocation is determined by the `OptLevel` selected on the command |
| 8 | //! line (`-O0` through `-Ofast`). |
| 9 | |
| 10 | pub mod alias; |
| 11 | pub mod bce; |
| 12 | pub mod call_resolve; |
| 13 | pub mod callgraph; |
| 14 | pub mod const_arg; |
| 15 | pub mod const_fold; |
| 16 | pub mod const_prop; |
| 17 | pub mod cse; |
| 18 | pub mod dce; |
| 19 | pub mod dead_arg; |
| 20 | pub mod dead_func; |
| 21 | pub mod dep_analysis; |
| 22 | pub mod dse; |
| 23 | pub mod fast_math; |
| 24 | pub mod fission; |
| 25 | pub mod fusion; |
| 26 | pub mod global_lsf; |
| 27 | pub mod gvn; |
| 28 | pub mod inline; |
| 29 | pub mod interchange; |
| 30 | pub mod jump_thread; |
| 31 | pub mod licm; |
| 32 | pub mod loop_tree; |
| 33 | pub mod loop_utils; |
| 34 | pub mod lsf; |
| 35 | pub mod mem2reg; |
| 36 | pub mod neon_vectorize; |
| 37 | pub mod pass; |
| 38 | pub mod peel; |
| 39 | pub mod pipeline; |
| 40 | pub mod preheader; |
| 41 | pub mod return_prop; |
| 42 | pub mod simplify_cfg; |
| 43 | pub mod sccp; |
| 44 | pub mod sroa; |
| 45 | pub mod strength_reduce; |
| 46 | pub mod unroll; |
| 47 | pub mod unswitch; |
| 48 | pub mod util; |
| 49 | pub mod vectorize; |
| 50 | |
| 51 | #[cfg(test)] |
| 52 | mod audit_tests; |
| 53 | |
| 54 | // Public surface of the opt module: only the entry points the |
| 55 | // driver actually uses. Audit Cos-2: previously every pass was |
| 56 | // re-exported behind `#[allow(unused_imports)]`, which masked any |
| 57 | // future regressions that orphaned a re-export. |
| 58 | pub use pipeline::{build_i128_pipeline, build_pipeline, OptLevel}; |
| 59 | |
| 60 | // Test-only re-export so audit_tests can refer to passes by their |
| 61 | // short name without the full module path. |
| 62 | #[cfg(test)] |
| 63 | pub use cse::LocalCse; |
| 64 |