Compiler Optimizations
Compiler can improve performance by improving processor utilization and cache utilization.
- Partial evaluation: Constant Folding & Propagation
- Dead Code Elimination (DCE)
- Common Subexpression Elimination (CSE)
- Strength Reduction
- Local Value Numbering
- Loop optimizations
- Natural loops
- Loop Unrolling
- Loop Fusion
- Loop Invariant Code Motion
- Inlining
- Inlining too much results in instruction cache misses
- Devirtualization
- Auto-Vectorization (SIMD)
- Instruction Scheduling
- Dependence Analysis
- Peephole
- Tail Call Elimination
- Profile-Guided Optimization (PGO)
- Removing runtime checks, e.g. bounds checks and runtime type checks for dynamic languages
Analysis
Data-Flow Analysis
Popular framework for figuring out facts about basic blocks. Can be forward (reverse post-order) or backward (post-order).
Escape Analysis
Analysis can hint to perform the allocation on the stack, instead of the heap.