Complete removal of redundant expressions

被引:49
作者
Bodik, R [1 ]
Gupta, R [1 ]
Soffa, ML [1 ]
机构
[1] Univ Pittsburgh, Dept Comp Sci, Pittsburgh, PA 15260 USA
关键词
partial redundancy elimination; control flow restructuring; speculative execution; demand-driven frequency data-flow analysis; profile-guided optimization;
D O I
10.1145/277652.277653
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Partial redundancy elimination (PRE), the most important component of global optimizers, generalizes the removal of common subexpressions and loop-invariant computations. Because existing PRE implementations are based on code motion, they fail to completely remove the redundancies. In fact, we observed that 73% of loop-invariant statements cannot be eliminated from loops by code motion done. In dynamic terms, traditional PRE eliminates only half of redundancies that are strictly partial. To achieve a complete PRE, control flow restructuring must be applied. However, the resulting code duplication may cause code size explosion. This paper focuses on achieving a complete PRE while incurring an acceptable code growth. First, we present an algorithm for complete removal of partial redundancies, based on the integration of code motion and control flow restructuring. In contrast to existing complete techniques, we resort to restructuring merely to remove obstacles to code motion, rather than to carry out the actual optimization. Guiding the optimization with a profile enables additional code growth reduction through selecting those duplications whose cost is justified by sufficient execution-time gains. The paper develops two methods for determining the optimization benefit of restructuring a program region, one based on path-profiles and the other on data-flow frequency analysis. Furthermore, the abstraction underlying the new PRE algorithm enables a simple formulation of speculative code motion guaranteed to have positive dynamic improvements. Finally, we show how to balance the three transformations (code motion, restructuring, and speculation) to achieve a near-complete PRE with very little code growth. We also present algorithms for efficiently computing dynamic benefits. In particular, using an elimination-style data-flow framework, we derive a demand-driven frequency analyzer whose cost can be controlled by permitting a bounded degree of conservative imprecision in the solution. Keywords: partial redundancy elimination, control flow restructuring, speculative execution, demand-driven frequency data-flow analysis, profile-guided optimization.
引用
收藏
页码:1 / 14
页数:14
相关论文
共 30 条
[1]  
Aho Alfred V., 1986, COMPILERS PRINCIPLES
[2]   PROGRAM DATA FLOW ANALYSIS PROCEDURE [J].
ALLEN, FE ;
COCKE, J .
COMMUNICATIONS OF THE ACM, 1976, 19 (03) :137-147
[3]  
AMMONS G, 1998, P ACM SIGPLAN 98 C P
[4]  
Ammons Glenn, 1997, P ACM SIGPLAN 97 C P, P85, DOI [10.1145/258915, DOI 10.1145/258915]
[5]  
AUSLANDER J, 1996, P ACM SIGPLAN 96 C P, P149
[6]  
AYERS A, 1997, P ACM SIGPLAN 97 C P, P134
[7]  
BALL T, 1996, 29 ANN IEEE ACM INT, P46
[8]  
BODIK R, 1998, 25 ACM SIGPLAN SIGAC
[9]  
BODIK R, 1997, P ACM SIGPLAN 97 C P, P146
[10]  
BODIK R, THESIS U PITTSBURGH