Top Banner

of 59

PRE Slides

Apr 03, 2018

Download

Documents

Smitha Vas
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/28/2019 PRE Slides

    1/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Code optimization by

    partial redundancy elimination

    using Eliminatability paths (E-paths)

    Prof. Dhananjay M Dhamdhere

  • 7/28/2019 PRE Slides

    2/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    These slides are based on

    D. M. Dhamdhere: E-path_PRE---Partial redundancyelimination made easy, SIGPLAN Notices, v 37, n 8

    (2002), 53-65.

    D. M. Dhamdhere: Eliminatability path---A versatile basisfor partial redundancy elimination, 2002

    Dheeraj Kumar: Syntactic and Semantic PartialRedundancy elimination, M. Tech. dissertation,I.I.T. Bombay, 2006.

  • 7/28/2019 PRE Slides

    3/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Partial redundancy elimination

    Partial redundancy

    An expression ein statement sis partially redundant if its value isidentical with value ofein some path from start of program to s

    Partial redundancy elimination

    -- A partially redundant occurrence ofeis made totally redundant byinserting evaluations ofein some path(s) from start of theprogram to s

    -- The totally redundant occurrence ofeis now eliminated

  • 7/28/2019 PRE Slides

    4/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    An example of PRE

    a*b

    a*b

    1 2

    3

    -- Insert a*b in node 2

    -- Delete a*b from node 3

    t=a*b

    t

    1 2

    3

    t=a*b

  • 7/28/2019 PRE Slides

    5/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Partial redundancy elimination

    Common subexpression elimination (CSE)

    - Expression eis computed along all paths reaching its occurrence

    Loop invariant movement

    - A loop-invariant expression is available along the looping edge.

    Hence it is partially redundant.

    Classical code motion

    -

    A less known optimization. It is in fact partial redundancyelimination in specific situations.

    PRE subsumes 3 important classical optimizations:

  • 7/28/2019 PRE Slides

    6/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    PRE subsumes 3 optimizations

    a=.. a*b

    a*b

    a*b

    1

    2

    3

    4

    5

    6

    1. CSE

    - a*b of node 5 is a CSE.

    2. Loop invariant movement

    - a*b of node 4 is partiallyredundant

    3. Code movement

    - a*b of node 6 can be

    moved to node 3.

  • 7/28/2019 PRE Slides

    7/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Benefits and costs of PRE

    Benefits:Execution efficiency through a reduction in the number ofexpression occurrences along a graph path

    Costs:- Use of compiler generated temporaries to hold valuesof expressions

    - Lifetimes of compiler generated temporaries increase

    register pressure- Insertion of new blocks due to edge placement

    Desirable goals:Computational optimality and lifetime optimality

  • 7/28/2019 PRE Slides

    8/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Data flow concepts used in partial

    redundancy elimination

    Availability : An expression eis available at a program

    point pif its value is computed along ALL paths from

    start of the program to p

    Partial availability : An expression eis partially available

    at a program point pif its value is computed along SOME

    path from start of the program to p

    Availability = Total redundancy

    Partial availability = Partial redundancy

  • 7/28/2019 PRE Slides

    9/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Data flow concepts used in partial

    redundancy elimination

    Anticipatability: An expression eis anticipatable (that is,very busy) at a program point pif it is computed alongALL paths from pto an exit of the program

  • 7/28/2019 PRE Slides

    10/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Data flow concepts used in partial

    redundancy elimination

    Anticipatability: An expression eis anticipatable (that is,

    very busy) at a program point pif it is computed along

    ALL paths from pto an exit of the program

    Safety of a computation (Kennedy 1972): An expression

    eis safeat a program point pif it is either available or

    anticipatable at p

    - Insertion ofeat pis a new computation ifeis notsafe at p.

    - It increases the execution time of the program. It may

    also raise new exceptions

  • 7/28/2019 PRE Slides

    11/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Safe insertion of computations

    a*b

    a*b

    a*b

    a*b

    11 12

    13

    21 22

    23

    -- Insertion of a*b in node 12 is safe, however in 22 it is unsafe

    -- Insertion in edge (22,23) is safe!

    -- a*b is anticipatable in node 12, but not anticipatable in node 22

  • 7/28/2019 PRE Slides

    12/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Some partial redundancies cannot be

    eliminated through safe code insertion

    a*b

    a*b

    i

    k

    m

    n

    t=a*b

    -- Insertion in the in-edge ofnode nis unsafe becausea*b is not anticipatable

    a*b available

    a*b anticipatable

    a*b available, anticipatable

  • 7/28/2019 PRE Slides

    13/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Performing Partial Redundancy

    Elimination

    Identify partially redundant occurrences of an expression ein a program

    Insert occurrences ofeat some program points where eis safe

    Delete partially redundant occurrences ofewhich have become totallyredundant

    Classical PRE: Elimination of partial redundancies in a program through safeinsertion of computations.

    - Can be looked upon as `code movement from the point of originaloccurrence to the point of insertion

    - It cannot eliminate all partial redundancies in a program!

  • 7/28/2019 PRE Slides

    14/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    A brief history of PRE

    Morel, Renvoise (1979): Bidirectional data flows for code placement in nodes (MRA).Lacks both computational and lifetime optimality.

    Dhamdhere (1988): Computational optimality and reduced lifetimes of temporariesthan Morel-Renvoise through placement in nodes and edges (EPA).

    Knoop, Ruthing, Steffen (1992): Lazy code motion (LCM) offering computationaloptimality and lifetime optimality through a priori edge splitting and placement innodes. Drechsler and Stadel (1993) reformulated LCM to handle basic blocks.

    Bodik, Gupta, Soffa (1998) : Complete elimination of partial redundancies throughselective code expansion (ComPRE). Based on the work by Steffen (1996).

    Kennedy et al (1999): PRE in SSA representation of programs (SSAPRE).

    Dhamdhere (2002): Eliminatability path --- A versatile basis for PRE(E-path_PRE). Develops a concept originating in Dhaneshwar, Dhamdhere (1995)and uses it for evaluation of PRE algorithms and development of new ones.

    Xue, Knoop (2006) and Dheeraj kumar, Dhamdhere (2006)

  • 7/28/2019 PRE Slides

    15/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Morel-Renvoise Algorithm (MRA)

    Performs insertions strictly in nodes of the program graph

    Placement possibility (PP) ofeat entry/exit of basic blocks:

    whether it is feasible and safe to place expression eat entry/exitof a block

    Insert eat the exit of a basic blockbif it can be placed at theexit ofbbut not at its entry

    Delete an existing occurrence ofein a basic block if it can beplaced at the entry of that block

  • 7/28/2019 PRE Slides

    16/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Morel-Renvoise Algorithm (MRA)

    (simplified equations)

  • 7/28/2019 PRE Slides

    17/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Morel-Renvoise Algorithm (MRA)

    a=.. a*b

    a*b

    a*b

    t=a*b

    t

    a=..

    t=a*b

    1

    2

    3

    4

    5

    6

    1

    2

    3

    4

    5

    6

    2. a*b of node 4 cannot be optimized because it cannot be inserted in node 1.

    t

    3. a*b is saved in t in nodes 2 and 4. a*b of node 6 is replaced by use of t.

    1. a*b is inserted in node 2. Insertion in node 3 would have been lifetime optimal.

  • 7/28/2019 PRE Slides

    18/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Edge placement algorithm

    (Dhamdhere 1988)

    Performs insertions both in nodes and along edges inthe program graph

    An expression is hoistedas far up as possible to obtain

    computational optimality It is then subjected to sinking(without affecting

    computational optimality) to obtain lifetime optimality

    It is placed along an edge only if it cannot be placed in a node

    It is performed only along a critical edge, i.e., an edge from abranch node to a join node

  • 7/28/2019 PRE Slides

    19/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Edge placement algorithm

    (Dhamdhere 1988)

  • 7/28/2019 PRE Slides

    20/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Edge placement algorithm

    (Dhamdhere 1988)A. Computational optimality:

    The term of PPIN is dropped. Hence PPIN can be true even ifPPOUT of a predecessor is false.

    If PP is true for entry of a basic blocki but PP is false for exit of apredecessorj, eis placed along the edge (j,i).

    -- It is called edge placement. A basic block is inserted in theedge ifeis to be placed along it.

    -- Edge placement performed only along a critical edge, i.e.along an edge from a branch node to a join node.

    Placement into nodes is done as in MRA.

  • 7/28/2019 PRE Slides

    21/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Edge placement algorithm

    (Dhamdhere 1988)

    B. Reducing lifetimes of expression variables:

    Move insertion points as far down as possible without sacrificing

    computational optimality (it is achieved by the term)

  • 7/28/2019 PRE Slides

    22/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Edge placement algorithm

    (Dhamdhere 1988)

    )PPIN(apx-PPOUT

    .)apx-PPOUT.Transp(Antloc

    .)Transp.Antloc(Pavinapx-PPIN

    succsucci

    iii

    iiii

    EPA solution technique: (hoisting-followed-by-sinking approach)

    1. Solve the unidirectional data flow problem obtained by omitting the term from the PPIN equation.

    2. Now a second data flow is solved to incorporate the term: Weexamine all predecessors of a blockiand change PPIN of blockifrom true to false if the term is false for its predecessors.

    It hoists eas far up as possible. Provides computational optimality.

    It sinks the hoisted expression as far down as possible withoutcompromising computational optimality.

  • 7/28/2019 PRE Slides

    23/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Edge placement algorithm (EPA)

    a=.. a*b

    a*b

    a*b

    t=a*b t

    a=..

    1

    2

    3

    4

    5

    6

    1

    2

    3

    4

    5

    6

    t=a*b

    1. a*b is inserted in node 3. However, EPA does not provide lifetime optimality in some cases.

    2. a*b is inserted in edge (1,4). This is computationally optimal.

    t

    t

  • 7/28/2019 PRE Slides

    24/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Lazy code motion (KRS 92)

    All join edges are split a priori by inserting blocks along them

    D-Safe-earliest points: An expression is placed at the earliest pointswhere it is anticipatable.

    Evaluation of an expression is delayed to the latest point where itcan be placed without losing computational optimality.

    Thus, it conceptually performs hoisting-followed-by-sinking, as inthe edge placement algorithm.

    Insertion and saving is performed uniformly.

    Data flow equations are not given here. (Drechsler and Stadelreformulated them.)

  • 7/28/2019 PRE Slides

    25/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Lazy code motion (KRS)

    a=.. a*b

    a*b

    a*b

    t

    a=..

    1

    2

    3

    4

    5

    6

    1

    2

    3

    4

    5

    6

    t=a*b

    2. a*b is inserted in edge (3,6). LCM provides lifetime optimality

    3. a*b is inserted in edge (1,4). As in EPA, this is computationally optimal

    t

    t

    t=a*b(3,6)

    t=a*b(1,4)

    1. Edges (1,4), (3,6), (5,6) and (5,4) are split a priori

    4. Empty blocks: removed

  • 7/28/2019 PRE Slides

    26/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability paths offer ..

    A conceptual basis for PRE:

    - Identifies partial redundancies which can beeliminated through insertion of code in safe places

    * We call them eliminatable partial redundancies

    - A simple method for identifying safe insertion points

    which offer lifetime optimality

    - Thus, no hoisting-followed-by-sinking

  • 7/28/2019 PRE Slides

    27/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability paths offer ..

    Computationally optimal PRE:

    - Elimination of all eliminatable partial redundanciesidentified by E-paths through appropriate

    insertions provides computational optimality

  • 7/28/2019 PRE Slides

    28/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability paths offer ..

    PRE with lifetime optimality:

    - Insertions performed using the notion of E-pathsprovides lifetime optimality

  • 7/28/2019 PRE Slides

    29/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability paths offer ..

    A versatile basis for PRE:

    - Classical PRE: PRE performed by insertion, deletion and

    saving of expressions over a program graph

    - PRE over SSA representations of programs

  • 7/28/2019 PRE Slides

    30/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability paths offer ..

    Simplicity:

    - Insertion, deletion and save points are identified using

    simple and well-known data flow concepts of availability

    and anticipatability

  • 7/28/2019 PRE Slides

    31/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability paths offer ..

    A basis for evaluating effectiveness of an approach toPRE:

    - Does the approach provide computational optimality?(i.e. does it eliminate all partial redundancies which canbe eliminated?)

    - Does the approach provide lifetime optimality?

  • 7/28/2019 PRE Slides

    32/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability Paths (E-paths)

    A path i .. kin a program control flow graph is an E-path for anexpression eif

    - Node icontains a locally available occurrence of e and node k

    contains a locally anticipatable occurrence ofe

    - Nodes in the path (i .. k) are empty wrt e, i.e. they do not containan occurrence ofeor a definition of any of its operands

    - eis safe at the exit of each node in [i .. k), i.e., it is either availableor anticipatable at the exit of each node in [i .. k).

    Path [i .. k) includes node i, but excludes node k.Path (i .. k) excludes nodes iand k.

  • 7/28/2019 PRE Slides

    33/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Eliminatability Path*

    a*b

    a*b

    i

    k

    m

    n

    - a*b available at exit of [i .. m]

    - a*b anticipatable at exit of [n .. k)

    - Occurrence of a*b in node k

    is said to be eliminatable

    * Dhaneshwar, Dhamdhere (1995) usedeliminatability of exps, but did notdefine or use E-paths explicitly.

  • 7/28/2019 PRE Slides

    34/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Properties of E-paths: 1

    PRE using E-paths provides computational optimality

    Use of this property:

    - Use it to evaluate computationaloptimality of a PRE algorithm.

    - A PRE algorithm possesses computational optimality if it caneliminate partial redundancy ofein EACH node ksuch thatan E-path i .. kexists in G.

  • 7/28/2019 PRE Slides

    35/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Properties of E-paths: 2

    Ifi .. kis an E-path andj is a node in (i .. k]

    - For each in-edge (g, j) such that node gis not in an E-path:

    if node ghas a successor swhich is not in an E-paththen insert ein edge (g, j)else insert ein node g

    - Such insertion provides lifetime optimality of the temporary variableused to hold value ofe

    Use of the property:

    - Check whether a PRE algorithm provides lifetime optimality by comparingprogram points where insertions are made

  • 7/28/2019 PRE Slides

    36/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Lifetime optimality using E-paths

    a*b

    a*b

    i

    k

    m

    j

    g1

    t=a*b

    - Insertion in edge (g1,j) and

    node g2 is lifetime optimal

    g2

    t=a*b

    - i .. kis an E-path

  • 7/28/2019 PRE Slides

    37/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Evaluating MRA using E-paths

    a=.. a*b

    a*b

    a*b

    t=a*b

    t

    a=..

    t=a*b

    1

    2

    3

    4

    5

    6

    1

    2

    3

    4

    5

    6

    1. 5 .. 6 is an E-path. Insertion node 3 would have been lifetime optimal.

    t

    2. 5 .. 4 is an E-path. Hence a*b of node 4 is eliminatable, but not eliminated!

    0. Three E-paths exist: 4 .. 5, 5 .. 4 and 5 .. 6.

  • 7/28/2019 PRE Slides

    38/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    PRE using E-paths

    For an E-path i .. k

    a) Insertions: For a nodejin (i .. k]

    - Insert ein edge (g, j) ifgis not in an E-path and has a

    successor which is not in an E-path

    - Insert ein predecessor gifgis not in an E-path and all itssuccessors are in E-paths

    b) Save: Save the computation ofein node i, unless iis theend-node of some E-path h .. i(in which case it would bedeleted).

    c) Deletion: Delete the occurrence ofein node k.

  • 7/28/2019 PRE Slides

    39/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    PRE using E-paths

    E-path i.. kmay contain 3 kinds of segments

    - Avail . Ant segment- Avail . Ant segment- Avail . Ant segment : This is called the E-path suffix.

    Find a node m : Avail(m) . Anticipatable(m). Avail(p), p=predThis is the start node of the E-path suffix.

    - Trace Avail . Ant segment backwards from m to find node i, the

    start of the E-path and perform a save in it

    - Trace Avail . Ant segment forward from ma) to perform appropriate insertion for in-edgesb) to find kand perform a deletion

  • 7/28/2019 PRE Slides

    40/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Segments in an E-Path

    a*b

    a*b

    1

    2

    3

    4

    5

    10

    a) 1 .. 2 : Avail Ant.

    b) 3 .. 4 : Avail Ant.

    c) 5 .. 10 : Avail Ant(E-path suffix).

    E-path suffix: insertions may be neededin paths joining it

    Start nodeOf E-path

    suffix

  • 7/28/2019 PRE Slides

    41/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Simple data flows for E-path_PRE@

    Comp : eis locally available (i.e. downwards exposed) in node

    Antloc : eis locally anticipatable (i.e. upwards exposed) in node

    Transp : node does not contain definitions ofes operands

    @ : Terminology is from Morel-Renvoise algorithm

  • 7/28/2019 PRE Slides

    42/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Simple data flows for E-path_PRE

    Availability and Anticipatability (i.e. very busy exps.)

    Eps-in/Eps-out (Node is in E-path suffix)

  • 7/28/2019 PRE Slides

    43/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Simple data flows for E-path_PRE

    Availability and Anticipatability

    Eps-in/Eps-out (Node is in E-path suffix)

    SA_in/SA_out (A save should be performed above)

  • 7/28/2019 PRE Slides

    44/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Efficiency of E-path_PRE data

    flows The generalized theory of bit-vector data flow analysis by Khedker,

    Dhamdhere (1994) defines two concepts for determining the cost of dataflow analysis

    - Information flow path (ifp): A graph path along which data flowinformation may flow during data flow analysis.

    (Information flow : Values of data flow properties change from`latticetop to `lattice bot during iterative data flow analysis)

    -Width of a graph (reduces to depth of a graph for unidirectional dataflows)

    ff f

  • 7/28/2019 PRE Slides

    45/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Efficiency of E-path_PRE data

    flows The generalized theory of bit-vector data flow analysis by Khedker,

    Dhamdhere (1994) defines two concepts for determining the cost of dataflow analysis

    - Information flow path (ifp): A graph path along which data flowinformation may flow during data flow analysis.

    (Information flow : Values of data flow properties change from`latticetop to `lattice bot during iterative data flow analysis)

    -Width of a graph (reduces to depth of a graph for unidirectional dataflows)

    Number of bit-vector operations during work-list iterative df analysisdepend on length of an ifp, and the number of iterations duringround-robin iterative df analysis depend on width of an ifp

    Effi i f E h PRE d

  • 7/28/2019 PRE Slides

    46/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Efficiency of E-path_PRE data

    flows The Eps_in/out data flow of E-path_PRE has been designed to have

    short information flow paths. This fact may also lead to smallwidth of a program graph.

    Short information flow paths and small width leads to smaller

    solution times of data flows.

    This fact is borne out by experimentation --- comparison with thelater data flow of Drechsler, Stadel (1993) (Dhamdhere 2002):

    - In worklist solution: No. of bit vector operations is 80% smaller

    - In round-robin iterative solution: No. of iterations is 37% smaller

  • 7/28/2019 PRE Slides

    47/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Code placement models in PRE

    Node model

    - Simple node modelEach node contains a single statement

    - Basic block modelEach node is a basic block

    Insertion and Saving model

    - Saving in situValue of an expression is saved in the place where it is located

    - Saving in entry/exit of nodeAn expression is moved to node entry/exit if its value is to be saved

    - Insertion at entry/exit of node- Unified insertion and saving

    This is possible only when saving is done at node entry/exit

  • 7/28/2019 PRE Slides

    48/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Code placement models in PRE

    Morel-Renvoise Algorithm (MRA):- Basic blocks, saving in situ, insertion at exit

    Edge placement algorithm (EPA):- Basic blocks, saving in situ, insertions at node exit and in critical edges

    (edge splitting performed on a needs basis)

    Lazy Code Motion (LCM):- Simple nodes, unified saving and insertion, insertion at node entries and

    in blocks inserted in join edges in a priori edge splitting

    E_path-PRE- Basic blocks, saving in situ, insertions at node exit and in critical edges

    SIM-PRE- Basic blocks, saving in situ, insertion strictly along edges

  • 7/28/2019 PRE Slides

    49/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Evaluation of code placement

    models using E-paths

    Morel-Renvoise algorithm (MRA)

    Missed opportunities of optimization (seen before)

    Lazy code motion (LCM)Performs insertion in a join edge (p,j) even if it could have been

    performed in node p

    a*b

    a*b

    a*b inserted

    1

    3

    2

    E l ti f d l t

  • 7/28/2019 PRE Slides

    50/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Evaluation of code placement

    models using E-paths

    Optimal code motion (OCM) Knoop et al 1994

    - Basic blocks, Hybrid model, Insertions at node entry and exit

    - Hybrid: Uniform insertion and saving model but saving isperformed in situ

    No insertions and savings will be performed at entry to a node

    (Lemmas 19 and 23). Hence this feature is redundant.

    E l ti f d l t

  • 7/28/2019 PRE Slides

    51/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Evaluations of code placement

    models using E-paths

    Complete elimination of partial redundancies (ComPRE)

    Bodik, Gupta and Soffa (1998) (when adapted to classical PRE)

    - Simple nodes, unified saving and insertion only in edges

    An expression in a node is redundantly hoisted into its entry-edges

    - Addressing this problem will require an additional data flow

    problem, making it less efficient than E-path_PRE.

  • 7/28/2019 PRE Slides

    52/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Later work

    SIM-PRE by J. Xue, J. Knoop (2006): inserts only along edges

  • 7/28/2019 PRE Slides

    53/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    SIM-PRE by Xue and Knoop

    This data flow traces an E-path !

  • 7/28/2019 PRE Slides

    54/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    SIM-PRE by Xue and Knoop

    a*b

    a*b

    i

    k

    m

    j

    g1

    t=a*b

    - Insertion in edge (g1,j) and

    node g2 is lifetime optimal

    g2 - i .. kis an E-path

    - SIM-PRE inserts in edges(g1,j) and (g2, l)

    l

    t = a*b

  • 7/28/2019 PRE Slides

    55/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    SIM-PRE by Xue and Knoop

    SIM-PRE performs better than E-path_PRE in bit vector operations(Graphic is from J. Xue, J. Knoop (2006))

    However, it adds almost 50% more new blocks than E-path_PRE(Dheeraj Kumar, 2006)

  • 7/28/2019 PRE Slides

    56/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Work by Dheeraj Kumar (2006)@

    Simplified the data flows of E-path_PRE Eps_in/outdata flow finds nodes {i} that belong to an E-path

    and haveAntouti= true

    SA_in/outdata flow finds nodes {i} that belong to an E-pathand haveAvouti= true

    @ : M. Tech. dissertation, IIT Bombay

  • 7/28/2019 PRE Slides

    57/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Work by Dheeraj Kumar (2006)

    Simplified data flows of E-path_PRE (Proposal 2):

  • 7/28/2019 PRE Slides

    58/59

    ComputerScience & Engineering, Indian Institute of Technology, Bombay

    Work by Dheeraj Kumar (2006)

    Experimental results

    - SPECcpu2000 benchmark under GCC 3.4.3

    - Proposal 2 performance

    * Bit map operations 5.5% smaller than SIM-PREin worklist and 15.8% smaller in iterative

    * Introduced 30% fewer blocks than SIM-PRE

  • 7/28/2019 PRE Slides

    59/59

    Thus, eliminatability paths offer ..

    A conceptual basis for PRE

    A versatile basis for PRE

    A basis for evaluating effectiveness of an approach to PRE

    (Efficiency is a bonus!)