skip to main content
article
Free Access

Optimization of array subscript range checks

Published:01 June 1992Publication History
Skip Abstract Section

Abstract

Compile-time elimination of subscript range checks is performed by some optimizing compilers to reduce the overhead associated with manipulating array data structures. Elimination and propagation, the two methods of subscript range check optimization, are less effective for eliminating global redundancies especially in while-loop structures with nonconstant loop guards. This paper describes a subscript range check optimization procedure that can eliminate more range checks than current methods. Two transformations called inner-loop guard elimination and conservative expression substitution are introduced to enhance propagation of range checks in nested while-loops and to define a partial order on related range checks. Global elimination is improved by considering range checks performed before control reaches a statement and after control leaves a statement. A unique feature of this method is the simplification of the available range-check analysis system for global elimination.

References

  1. 1 AHO, A. V., SETHI, R., AND ULLMAN, J. D. Compzlers: Principles, Techniques, and Tools. Addison-Wesley, Reading, Mass., 1986. Google ScholarGoogle Scholar
  2. 2 GUPTA, R. A fresh look at optimizing array bound checking. In Proceedings of the ACM SIGPLAN "90 Conference on Programming Language Design and Implementation (New York, June 1990), 272-282. Google ScholarGoogle Scholar
  3. 3 HARRISON, W. Compiler analysis of the value ranges for variables. IEEE Trans. Softw. Eng. SE-3, 3(May 1977), 243-250.Google ScholarGoogle Scholar
  4. 4 MARKSTEIN, V., COCKE, J., MARKSTEIN, P. Optimization of range checking. In Proceedings of ACM SIGPLAN "82 Symposium on Compiler Construction (June 1982), 114-119. Google ScholarGoogle Scholar
  5. 5 WEGMAN, M. N., AND ZADECK, F. K. Constant propagation with conditional branches, In Proceedings of the 12th ACM Symposium on Prznciples of Programming Languages (Jan. 1984), 152-161. Google ScholarGoogle Scholar
  6. 6 WELSH, J. Economic range checks in Pascal. Softw. Pract. Exper. 8 (1978), 85-97.Google ScholarGoogle Scholar

Index Terms

  1. Optimization of array subscript range checks

      Recommendations

      Reviews

      Zoran D. Budimac

      Asuru describes a subscript range check optimization procedure in the presence of loops. The procedure deals with loop invariant range checks and range checks whose subscript operands are induction variables. Since both kinds of range check are common in everyday programs, the optimization technique described is of substantial practical value. The optimization procedure consists of several steps: elimination of redundant inner loop guards, replacement of subscript operands of range checks with expressions of either the least or the greatest value of the subscript operands, conservative expression substitution, local range check optimization, loop relative global range check optimization, and range check propagation. Thanks to two newly introduced techniques, elimination of redundant inner loop guards and conservative substitution, it is possible to eliminate more range checks than in other known methods. The paper is concise, well written, and supported by appropriate examples and figures. It is easily readable by everyone with a general knowledge of compiler construction and optimization techniques. The paper contains several minor typographical errors (for example, a misplaced comma in the second paragraph on the second page).

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!