A Fast and Precise Static Loop Analysis Based on Abstract Interpretation, Program Slicing and Polytope Models

A static loop analysis is a program analysis computing loop iteration counts. This information is crucial for different fields of applications. In the domain of compilers, the knowledge about loop iterations can be exploited for aggressive loop optimizations like Loop Unrolling. A loop analyzer also provides static information about code execution frequencies which can assist feedback-directed optimizations. Another prominent application is the static worst-case execution time (WCET) analysis which relies on a safe approximation of loop iteration counts.In this paper, we propose a framework for a static loop analysis based on Abstract Interpretation, a theory of a sound approximation of program semantics. To accelerate the analysis, we preprocess the analyzed code using Program Slicing, a technique that removes statements irrelevant forthe loop analysis. In addition, we introduce a novel polytope-based loop evaluation that further significantly reduces the analysis time. The efficiency of our loop analyzer is evaluated on a large number of benchmarks. Results show that 99% of the considered loops could be successfully analyzed in an acceptable amount of time. This study points out that our methodology is best suited for real-world problems.

[1]  David A. Wagner,et al.  A class of polynomially solvable range constraints for interval analysis without widenings , 2005, Theor. Comput. Sci..

[2]  Jan Gustafsson,et al.  Automatic Derivation of Loop Bounds and Infeasible Paths for WCET Analysis Using Abstract Execution , 2006, 2006 27th IEEE International Real-Time Systems Symposium (RTSS'06).

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

[4]  Michael D. Smith,et al.  Overcoming the Challenges to Feedback-Directed Optimization , 2000, Dynamo.

[5]  Vincent Loechner,et al.  Analytical computation of Ehrhart polynomials: enabling more compiler analyses and optimizations , 2004, CASES '04.

[6]  Nicolas Halbwachs,et al.  Automatic discovery of linear restraints among variables of a program , 1978, POPL.

[7]  Philippe Granger Static analysis of arithmetical congruences , 1989 .

[8]  José Nelson Amaral,et al.  Aestimo: a feedback-directed optimization evaluation tool , 2006, 2006 IEEE International Symposium on Performance Analysis of Systems and Software.

[9]  Peter Marwedel,et al.  Source Code Optimization Techniques for Data Flow Dominated Embedded Software , 2004, Springer US.

[10]  Christoph Cullmann,et al.  Data-Flow Based Detection of Loop Bounds , 2007, WCET.

[11]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[12]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[13]  Jan Gustafsson,et al.  Faster WCET flow analysis by program slicing , 2006, LCTES '06.

[14]  Patrick Cousot,et al.  Comparing the Galois Connection and Widening/Narrowing Approaches to Abstract Interpretation , 1992, PLILP.

[15]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1984, TOPL.

[16]  Jan Gustafsson,et al.  Deriving Annotations for Tight Calculation of Execution Time , 1997, Euro-Par.

[17]  David F. Bacon,et al.  Compiler transformations for high-performance computing , 1994, CSUR.

[18]  Karl J. Ottenstein,et al.  The program dependence graph in a software development environment , 1984, SDE 1.

[19]  Antoine Miné,et al.  The octagon abstract domain , 2001, Proceedings Eighth Working Conference on Reverse Engineering.

[20]  Jan Gustafsson,et al.  Loop Bound Analysis based on a Combination of Program Slicing, Abstract Interpretation, and Invariant Analysis , 2007, WCET.

[21]  Henrik Theiling,et al.  Design of a WCET-Aware C Compiler , 2006, 2006 IEEE/ACM/IFIP Workshop on Embedded Systems for Real Time Multimedia.

[22]  Mark David Weiser,et al.  Program slices: formal, psychological, and practical investigations of an automatic program abstraction method , 1979 .

[23]  Thomas W. Reps,et al.  Precise interprocedural chopping , 1995, SIGSOFT FSE.

[24]  David B. Whalley,et al.  Bounding loop iterations for timing analysis , 1998, Proceedings. Fourth IEEE Real-Time Technology and Applications Symposium (Cat. No.98TB100245).

[25]  Susan Horwitz,et al.  Incremental program testing using program dependence graphs , 1993, POPL '93.

[26]  Heiko Falk,et al.  Control Flow Driven Splitting of Loop Nests at the Source Code Level , 2003, DATE.

[27]  Trevor Mudge,et al.  MiBench: A free, commercially representative embedded benchmark suite , 2001 .

[28]  David W. Binkley,et al.  Interprocedural slicing using dependence graphs , 1990, TOPL.

[29]  David W. Binkley,et al.  Interprocedural slicing using dependence graphs , 1988, SIGP.

[30]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1987, TOPL.