Lecture 9
Induction
Induction Variables and
Strength Reduction
I.
Overview of optimization
II. Algorithm to find induction variables
Carnegie Mellon
Todd C. Mowry
15-745: Strength Reduction
1
Example
FOR i = 0 to 100
A[i] = 0;
i=0
L2: IF i>=100 GOTO L1
t1
Lecture 10
Partial Redundancy Elimination
Global code motion optimization
Remove partially redundant expressions
Loop invariant code motion
Can be extended to do Strength Reduction
No loop analysis needed
Bidirectional flow problem
Carnegie Mellon
Todd
Lecture 11
Lazy Code Motion
I.
Forms of redundancy (quick review)
global common subexpression elimination
loop invariant code motion
partial redundancy
II. Lazy Code Motion Algorithm
Al
Mathematical concept: a cut set
Basic technique (anticipation)
3 more
Lecture 12
Region-Based Analysis
I. Basic Idea
II. Algorithm
III. Optimization and Complexity
IV. Comparing region-based analysis with iterative
algorithms
algorithms
Reading: ALSU 9.7
Carnegie Mellon
Todd C. Mowry
15-745: Region-Based Analysis
1
Motivati
Lecture 13
Introduction
Introduction to
Static Single Assignment (SSA)
(Slides courtesy of Seth Goldstein.)
Carnegie Mellon
Todd C. Mowry
15-745: Intro to SSA
1
Values Locations
for (i=0; i+; i<10) cfw_
= i ;
Def-use chains help solve the problem.
for (
Lecture 14
SSA-Style Optimizations
(Slides courtesy of Seth Goldstein.)
Carnegie Mellon
Todd C. Mowry
15-745: SSA-Style Optimizations
1
Review: Minimal SSA
Each assignment generates a fresh variable.
At each join point insert functions for all live variab
Lecture 15
Register Allocation & Spilling
I. Introduction
II. Abstraction and the Problem
III. Algorithm
IV. Spilling
Reading: ALSU 8.8.4
Carnegie Mellon
Todd C. Mowry
15-745: Register Allocation
1
I. Motivation
Problem
Allocation of variables (pseudo-re
Lecture 16
Register Allocation:
Coalescing
(Slides courtesy of Seth Goldstein and David Koes.)
Carnegie Mellon
Todd C. Mowry
15-745: Register Spilling
1
Review: An Example, k=4
v <-
1
w <-
v+3
x <-
w+v
u <-
v
t <-
u+x
<-
w
<-
t
<-
u
Carnegie Mellon
Todd C
Lecture 18
List Scheduling & Global Scheduling
Reading: Chapter 10.3-10.4
Carnegie Mellon
Todd C. Mowry
15745: List & Global Scheduling
1
Review: The Ideal Scheduling Outcome
What prevents us from achieving this ideal?
Before
After
1 cycle
Time
N cycles
Lecture 19
Software Pipelining
I .
Introduction
II. Problem Formulation
III. Algorithm
Carnegie Mellon
Todd C. Mowry
15-745: Software Pipelining
1
I. Example of DoAll Loops
Machine:
Per clock: 1 read, 1 write, 1 (2-stage) arithmetic op, with hardware
loo