RICE UNIVERSITY ValueDriven Redundancy Elimination by Loren Taylor Simpson A Thesis Submitted in Partial Fulfillment of the Requirements for the Degree Do ctor of Philosophy Approved Thesis Committee Keith D Co op er Asso ciate Professor Chair Department of Computer Science Rice University Linda Torczon FacultyFellow Department of Computer Science Rice University Ken Kennedy Noah Harding Professor Department of Computer Science Rice University Sarita Adve Assistant Professor Department of Electrical and Computer Engineering Rice University Houston Texas April ValueDriven Redundancy Elimination Loren Taylor Simpson Abstract Valuedriven redundancy elimination is a combination of value numb ering and co de motion Value numb ering is an optimization that assigns numb ers to values in sucha waythattwovalues are assigned the same numb er if the compiler can prove they are equal When this optimization discovers two computations that pro duce the same value it can under certain circumstances eliminate one of them Co de motion is an optimization that attempts to move instructions to less frequently executed lo cations Traditional techniques must assume that every denition pro duces a distinct value Therefore an instruction cannot move past a denition of one of its sub expressions This restriction can b e relaxed when certain denitions are known to pro duce redun dantvalues By understanding how these two optimizations interact we can simplify each of them and the resulting combination will b e more p owerful than the sum of the two parts Value numb ering will b e simpler b ecause it need not b e concerned with eliminating instructions and co de motion will b e simpler b ecause identifying sub expressions is not necessary This researchinvestigates this valuedriven approach to redundancy elimination We improve up on the known algorithms for b oth value numb ering and co de motion and we show exp erimental evidence of their eectiveness Acknowledgments Tosay that this thesis has b een an individual eort would b e grossly misleading Many p eople havecontributed to this work in tangible and intangible ways I would rst like to thank Go d for leading me to Rice and surrounding me with wonderful friends and coworkers My wife Sallye and myparents and her parents have provided me with constant supp ort and encouragement The memb ers of my committee are Keith Co op er Linda Torczon Ken Kennedy and Sarita Adve They have contributed greatly to this research I admire and resp ect them deeply and I am honored to b e asso ciated with them This research has b een part of the Massively Scalar Compiler Pro ject at Rice University The pro ject is supp orted by ARPA and Vivek Sarkar of IBM has provided my supp ort The memb ers of the group past and present are Keith Co op er Linda Torczon Ken Kennedy Preston Briggs Tim Harvey Lisa Thomas Rob Shillingsburg Cli Click Chris Vick John Lu Edmar Wienskoski Phil Schielke and Linlong Jiang Preston Briggs was a great inuence during myearlyyears as a graduate student and I regret that he is no longer a memb er of our pro ject Tim Harvey has b een the kind of friend who will go out of his way to help someone and then denythatitwas any trouble at all Bob Morgan of DEC has shown a great deal of interest in the pro ject and he has encouraged our researc h in the area of redundancy elimination Dave Sp ott and David Wallace of Sun Microsystems are implementing the algorithm for SCCbased value numb ering in their next generation compiler My time as a graduate student at Rice has b een one of the most rewarding p erio ds in my life This is due in part to the standard of excellence set by the past and present Rice graduate students Contents Abstract ii Acknowledgments iii List of Illustrations vii Intro duction Intermediate Representations Static Single AssignmentForm Optimization Classication of Optimizations Safety Opp ortunity and Protability Redundancy Elimination Organization of the Thesis HashBased Value Numb ering Static Single AssignmentForm DominatorTree Value Numb ering Incorp orating Value Numb ering into SSA Construction Unied Hash Table Interaction with Other Optimizations Data Structures Extensions Summary Value Partitioning Complexity Data Structures to Supp ort Partitioning Rening the Partition Handling Commutative Op erations Eliminating Redundant Stores v Summary SCCBased Value Numb ering Shortcomings of Previous Techniques The RPO Algorithm Extensions Discussion The SCC Algorithm Example Uninitialized Values Summary Co de Removal DominatorBased Removal AVAILBased Removal Summary Co de Motion Partial Redundancy Elimination Lazy Co de Motion Critical Edges Moving LOAD Instructions Summary Value Driven Co de Motion VDCM Algorithm Examples Summary Relief of Register Pressure Identifying Blo cks with High Register Pressure Cho osing Expressions to Relieve Pressure Selecting Lo cations to Insert Instructions Results Summary vi Exp erimental Results Exp erimental Compiler Tests Performed Raw Instruction Counts Normalized Instruction Counts Comparison with Previous State of the Art Compile Times Relief of Register Pressure Summary Recommendations Summary of Contributions A Op erator Strength Reduction A The Algorithm A Preliminary Transformations A Finding Region Constants and Induction Variables A Co de Replacement A Example A Running Time A Linear Function Test Replacement A Followup Transformations A Previous Work A Summary Bibliography Illustrations Organization of a typical compiler Program b efore conversion to SSA Program after conversion to SSA Value numb ering example CFG for ifthenelse construct Dominatortree value numb ering Dominatortree value numb ering example Value numb ering during SSA construction Unied hash table Interaction with other optimizations Data structure for scop ed hash table Example program containing loadsandstores Partitioning algorithm Partitioning example Partitioning steps for example program Incorrect partition when p ositions are ignored Op erations supp orted by the partition Data structures for representing the partition Data structures for rening the partition Commutativity example Partition for second commutativity example Data structures for handling commutative op erations Example program for redundantstore elimination Initial partition for redundantstore elimination example Partition to enable redundantstore elimination viii Data structures for redundantstore elimination Improved by hashbased techniques Improved by partitioning techniques The RPO algorithm Example requiring D SSA iterations Example with D CFG D SSA Tarjans SCC nding algorithm SCCbased value numb ering algorithm Example with equal induction variables Example with edges removed from SCC Example with uninitialized values Program improved by dominatorbased removal Program improved byAVAILbased removal Naivebucket sorting algorithm Better bucket sorting algorithm Example program Dataow equations for AVAILbased removal Program improved by partial redundancy elimination Unnecessary co de motion Dataow equations for lazy co de motion Part Dataow equations for lazy co de motion Part Splitting a critical edge Incorrect motion of a store instruction Algorithm for computing altered using values Algorithm for computing altered using lexical names Expression tree VDCM example Another VDCM example Example where redundancy elimination decreases register pressure ix Motivating example for heuristic Motivating example for heuristic Motivating example for heuristic Dataow equations for relief of register pressure Sample ILOC routine Numb er of ILOC op erations for hashbased value numb ering techniques Sp ec b enchmark Numb er of ILOC op erations for value partitioning techniques Sp ec b enchmark Numb er of ILOC op erations for SCCbased value numb ering techniques Sp ec b enchmark Numb er of ILOC op erations for hashbased value numb ering techniques FMM b enchmark Numb er of ILOC op erations for value partitioning techniques FMM b enchmark Numb er of ILOC op erations for SCCbased value numb
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages150 Page
-
File Size-