The reason it's so important is that inlining synergises with other optimizations, its often run before or after other passes like constant propagation. Consider something like:
fn add(x : usize, y : usize) -> usize { x + y }
fn main() {
add(5, 1)
}
Without inlining we can't easily optimize the code of `main`. However, if we inline `add` into main, constant propagation will then directly see `5 + 1` and optimize that into `6`.
The reason it's so important is that inlining synergises with other optimizations, its often run before or after other passes like constant propagation. Consider something like:
Without inlining we can't easily optimize the code of `main`. However, if we inline `add` into main, constant propagation will then directly see `5 + 1` and optimize that into `6`.