This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Optimization Last Time Building SSA • Basic definition, and why it is useful • How to build it Today • Putting SSA to work • Analysis and Transformation – Analysis- proves facts about programs – Transformation- changes the program to make it “better” while preserving its semantics • SSA Loop Optimizations – Loop Invariant Code Motion – Induction variables – While we do the above, let’s think about comparing SSA with dataflow def/use chains. CS 380C Lecture 8 1 Optimizations with SSA Loop Optimization Loops are important, they execute often • typically, some regular access pattern regularity ⇒ opportunity for improvement repetition ⇒ savings are multiplied • assumption : loop bodies execute 10 depth times Classical Loop Optimizations • Loop Invariant Code Motion • Induction Variable Recognition • Strength Reduction • Linear Test Replacement • Loop Unrolling Other Loop Optimizations • Scalar replacement • Loop Interchange • Loop Fusion • Loop Distribution (also known as Fision) • Loop Skewing • Loop Reversal CS 380C Lecture 8 2 Optimizations with SSA Loop Invariant Code Motion • Build the SSA graph • Need Briggs-minimal insertion of φ-nodes If two non-null paths X + → Z and Y + → Z converge at node Z, and nodes X and Y contain assignments to V (in the original program), then a φ-node for V must be inserted at Z (in the new program)....
View Full Document
- Fall '08
- Compiler optimization, Compiler optimizations, CS 380C Lecture