An efficient static analysis algorithm to detect redundant memory operations

As memory system performance becomes an increasingly dominant factor in overall system performance, it is important to optimize programs for memory related operations. This paper concerns static analysis to detect redundant memory operations and enable other compiler transformations to remove such redundant operations.We present an extended global value numbering algorithm to detect redundant memory operations. The key of the new algorithm is a novel SSA-based representation for memory state which allows accurate reasoning about memory state. Using this representation, the algorithm can trace values through memory operations to detect equivalence in the same way that it traces them through register-based scalar operations. Thus it discovers both redundancy involving scalar values and redundancy involving memory operations. The redundancy relation detected by the algorithm can then be used by traditional redundancy elimination transformations to remove those redundant operations.Experiments using a suite of realistic applications demonstrate the algorithm is powerful and fast. In practice, it has essentially linear time complexity.

[1]  J. Cocke Global common subexpression elimination , 1970, Symposium on Compiler Optimization.

[2]  Jeffrey D. Ullman,et al.  Global Data Flow Analysis and Iterative Algorithms , 1976, J. ACM.

[3]  Etienne Morel,et al.  Global optimization by suppression of partial redundancies , 1979, CACM.

[4]  Samuel P. Harbison An architectural alternative to optimizing compilers , 1982, ASPLOS I.

[5]  Mark N. Wegman,et al.  Constant propagation with conditional branches , 1985, POPL.

[6]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[7]  Bowen Alpern,et al.  Detecting equality of variables in programs , 1988, POPL '88.

[8]  Bernhard Steffen,et al.  Lazy code motion , 1992, PLDI '92.

[9]  Ron Cytron,et al.  Efficient accommodation of may-alias information in SSA form , 1993, PLDI '93.

[10]  Jong-Deok Choi,et al.  Efficient flow-sensitive interprocedural computation of pointer-induced aliases and side effects , 1993, POPL '93.

[11]  Alain Deutsch,et al.  Interprocedural may-alias analysis for pointers: beyond k-limiting , 1994, PLDI '94.

[12]  R. lAIN Efficient context-sensitive pointer analysis for c programs , 1995 .

[13]  Robert Paige,et al.  Using Multiset Discrimination to Solve Language Processing Problems Without Hashing , 1995, Theor. Comput. Sci..

[14]  Erik Ruf,et al.  Context-insensitive alias analysis reconsidered , 1995, PLDI '95.

[15]  Keith D. Cooper,et al.  Combining analyses, combining optimizations , 1995, TOPL.

[16]  Monica S. Lam,et al.  Efficient context-sensitive pointer analysis for C programs , 1995, PLDI '95.

[17]  Raymond Lo,et al.  Effective Representation of Aliases and Indirect Memory Operations in SSA Form , 1996, CC.

[18]  Bjarne Steensgaard,et al.  Points-to analysis in almost linear time , 1996, POPL '96.

[19]  Keith D. Cooper,et al.  Value-driven redundancy elimination , 1996 .

[20]  Mikko H. Lipasti,et al.  Value locality and load value prediction , 1996, ASPLOS VII.

[21]  Keith D. Cooper,et al.  Value Numbering , 1997, Softw. Pract. Exp..

[22]  Miodrag Potkonjak,et al.  MediaBench: a tool for evaluating and synthesizing multimedia and communications systems , 1997, Proceedings of 30th Annual International Symposium on Microarchitecture.

[23]  Keith D. Cooper,et al.  Register promotion in C programs , 1997, PLDI '97.

[24]  G.S. Sohi,et al.  Dynamic instruction reuse , 1997, ISCA '97.

[25]  Raymond Lo,et al.  Register promotion by sparse partial redundancy elimination of loads and stores , 1998, PLDI.

[26]  Rastislav Bodík,et al.  Path-sensitive value-flow analysis , 1998, POPL '98.

[27]  Roy Dz-Ching Ju,et al.  A new algorithm for scalar register promotion based on SSA form , 1998, PLDI '98.

[28]  Frank Tip,et al.  Aggregate structure identification and its application to program analysis , 1999, POPL '99.

[29]  Rajiv Gupta,et al.  Load-reuse analysis: design and evaluation , 1999, PLDI '99.

[30]  Manuvir Das,et al.  Unification-based pointer analysis with directional assignments , 2000, PLDI '00.

[31]  Jun Yang,et al.  Load redundancy removal through instruction reuse , 2000, Proceedings 2000 International Conference on Parallel Processing.

[32]  Barbara G. Ryder,et al.  A schema for interprocedural modification side-effect analysis with pointer aliasing , 2001, TOPL.

[33]  A safe approximate algorithm for interprocedural pointer aliasing , 2004, SIGP.

[34]  Rajiv Gupta,et al.  Complete removal of redundant expressions , 1998, PLDI 1998.