Skip to main content

Speed and Precision in Range Analysis

  • Conference paper
Programming Languages

Abstract

Range analysis is a compiler technique that determines statically the lower and upper values that each integer variable from a target program may assume during this program’s execution. This type of inference is very important, because it enables several compiler optimizations, such as dead and redundant code elimination, bitwidth aware register allocation, and detection of program vulnerabilities. In this paper we describe an inter-procedural, context-sensitive range analysis algorithm that we have implemented in the LLVM compiler. During the effort to produce an industrial-quality implementation of our algorithm, we had to face a constant tension between precision and speed. The foremost goal of this paper is to discuss the many engineering choices that, due to this tension, have shaped our implementation. Given the breath of our evaluation, we believe that this paper contains the most comprehensive empirical study of a range analysis algorithm ever presented in the compiler related literature.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 72.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Barik, R., Grothoff, C., Gupta, R., Pandit, V., Udupa, R.: Optimal Bitwise Register Allocation Using Integer Linear Programming. In: Almási, G.S., Cascaval, C., Wu, P. (eds.) KSEM 2006. LNCS, vol. 4382, pp. 267–282. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  2. Bertrane, J., Cousot, P., Cousot, R., Feret, J., Mauborgne, L., Miné, A., Rival, X.: Static analysis and verification of aerospace software by abstract interpretation. In: I@A, pp. 1–38. AIAA (2010)

    Google Scholar 

  3. Bodik, R., Gupta, R., Sarkar, V.: ABCD: eliminating array bounds checks on demand. In: PLDI, pp. 321–333. ACM (2000)

    Google Scholar 

  4. Cong, J., Fan, Y., Han, G., Lin, Y., Xu, J., Zhang, Z., Cheng, X.: Bitwidth-aware scheduling and binding in high-level synthesis. In: Proceedings of the Asia and South Pacific Design Automation Conference, ASP-DAC 2005, January 18-21, vol. 2, pp. 856–861 (2005)

    Google Scholar 

  5. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: POPL, pp. 238–252. ACM (1977)

    Google Scholar 

  6. Cousot, P., Cousot, R., Feret, J., Mauborgne, L., Miné, A., Rival, X.: Why does astrée scale up? Form. Methods Syst. Des. 35(3), 229–264 (2009)

    Article  Google Scholar 

  7. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Kenneth Zadeck, F.: Efficiently computing static single assignment form and the control dependence graph. TOPLAS 13(4), 451–490 (1991)

    Article  Google Scholar 

  8. do Couto Teixeira, D., Pereira, F.M.Q.: The design and implementation of a non-iterative range analysis algorithm on a production compiler. In: SBLP, pp. 45–59. SBC (2011)

    Google Scholar 

  9. Gawlitza, T., Leroux, J., Reineke, J., Seidl, H., Sutre, G., Wilhelm, R.: Polynomial precise interval analysis revisited. Efficient Algorithms 1, 422–437 (2009)

    Article  Google Scholar 

  10. Lakhdar-Chaouch, L., Jeannet, B., Girault, A.: Widening with Thresholds for Programs with Complex Control Graphs. In: Bultan, T., Hsiung, P.-A. (eds.) ATVA 2011. LNCS, vol. 6996, pp. 492–502. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  11. Lattner, C., Adve, V.S.: LLVM: A compilation framework for lifelong program analysis & transformation. In: CGO, pp. 75–88. IEEE (2004)

    Google Scholar 

  12. Lhairech-Lebreton, G., Coussy, P., Heller, D., Martin, E.: Bitwidth-aware high-level synthesis for designing low-power dsp applications. In: ICECS, pp. 531–534. IEEE (2010)

    Google Scholar 

  13. Logozzo, F., Fahndrich, M.: Pentagons: a weakly relational abstract domain for the efficient validation of array accesses. In: SAC, pp. 184–188. ACM (2008)

    Google Scholar 

  14. Mahlke, S., Ravindran, R., Schlansker, M., Schreiber, R., Sherwood, T.: Bitwidth cognizant architecture synthesis of custom hardware accelerators. Computer-Aided Design of Integrated Circuits and Systems 20(11), 1355–1371 (2001)

    Article  Google Scholar 

  15. Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis. Springer (1999)

    Google Scholar 

  16. Oh, H., Brutschy, L., Yi, K.: Access Analysis-Based Tight Localization of Abstract Memories. In: Jhala, R., Schmidt, D. (eds.) VMCAI 2011. LNCS, vol. 6538, pp. 356–370. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  17. Oh, H., Heo, K., Lee, W., Lee, W., Yi, K.: Design and implementation of sparse global analyses for C-like languages. In: PLDI, pp. 229–238. ACM (2012)

    Google Scholar 

  18. Patterson, J.R.C.: Accurate static branch prediction by value range propagation. In: PLDI, pp. 67–78. ACM (1995)

    Google Scholar 

  19. Pereira, F.M.Q., Palsberg, J.: Register allocation by puzzle solving. In: PLDI, pp. 216–226. ACM (2008)

    Google Scholar 

  20. Rimsa, A., d’Amorim, M., Pereira, F.M. Q.: Tainted Flow Analysis on e-SSA-Form Programs. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 124–143. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  21. Simon, A.: Value-Range Analysis of C Programs: Towards Proving the Absence of Buffer Overflow Vulnerabilities, 1st edn. Springer (2008)

    Google Scholar 

  22. Sol, R., Guillon, C., Pereira, F.M.Q., Bigonha, M.A.S.: Dynamic Elimination of Overflow Tests in a Trace Compiler. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 2–21. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  23. Stephenson, M., Babb, J., Amarasinghe, S.: Bitwidth analysis with application to silicon compilation. In: PLDI, pp. 108–120. ACM (2000)

    Google Scholar 

  24. Su, Z., Wagner, D.: A Class of Polynomially Solvable Range Constraints for Interval Analysis without Widenings and Narrowings. In: Jensen, K., Podelski, A. (eds.) TACAS 2004. LNCS, vol. 2988, pp. 280–295. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  25. Su, Z., Wagner, D.: A class of polynomially solvable range constraints for interval analysis without widenings. Theoretical Computeter Science 345(1), 122–138 (2005)

    Article  MathSciNet  Google Scholar 

  26. Tallam, S., Gupta, R.: Bitwidth aware global register allocation. In: POPL, pp. 85–96. ACM (2003)

    Google Scholar 

  27. Venet, A., Brat, G.: Precise and efficient static array bound checking for large embedded c programs. SIGPLAN Not. 39, 231–242 (2004)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Campos, V.H.S., Rodrigues, R.E., de Assis Costa, I.R., Pereira, F.M.Q. (2012). Speed and Precision in Range Analysis. In: de Carvalho Junior, F.H., Barbosa, L.S. (eds) Programming Languages. Lecture Notes in Computer Science, vol 7554. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-33182-4_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-33182-4_5

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-33181-7

  • Online ISBN: 978-3-642-33182-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics