l5 - Lecture 5 Partial Redundancy Elimination I. Forms of...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Carnegie Mellon Lecture 5 Partial Redundancy Elimination I. Forms of redundancy global common subexpression elimination loop invariant code motion partial redundancy II. Lazy Code Motion Algorithm Mathematical concept: a cut set Basic technique (anticipation) 3 more passes to refine algorithm Reading: Chapter 9.5 M. Lam CS243: Partial Redundancy Elimination 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Carnegie Mellon Overview Eliminates many forms of redundancy in one fell swoop Originally formulated as 1 bi-directional analysis Lazy code motion algorithm formulated as 4 separate uni-directional passes backward, forward, forward, backward M. Lam CS243: Partial Redundancy Elimination 2
Background image of page 2
Carnegie Mellon I. Common Subexpression Elimination A common expression may have different values on different paths! On every path reaching p, expression b+c has been computed b, c not overwritten after the expression M. Lam CS243: Partial Redundancy Elimination 3 Build up intuition about redundancy elimination with examples of familiar concepts d = b + c a = b + c b = 7 d = b + c a = b + c b = 7 f = b + c d = b + c a = b + c
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Carnegie Mellon Loop Invariant Code Motion Given an expression (b+c) inside a loop, does the value of b+c change inside the loop? is the code executed at least once? M. Lam CS243: Partial Redundancy Elimination 4 a = t t = b + c a = b + c a = b + c b = read() a = b + c exit
Background image of page 4
Carnegie Mellon Partial Redundancy Can we place calculations of b+c such that no path re-executes the same expression Partial Redundancy Elimination (PRE) subsumes: global common subexpression (full redundancy) loop invariant code motion (partial redundancy for loops) M. Lam CS243: Partial Redundancy Elimination 5 Unifying theory: More powerful, elegant but less direct. d = b + c a = b + c
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Carnegie Mellon II. Preparing the Flow Graph Key observation Can replace a bi-directional (!) data flow with several unidirectional data flows much easier Better result as well! Definition: Critical edges source basic block has multiple successors destination basic block has multiple predecessors Modify the flow graph: (treat every statement as a basic block) To keep algorithm simple: restrict placement of instructions to the
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 03/12/2012.

Page1 / 21

l5 - Lecture 5 Partial Redundancy Elimination I. Forms of...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online