Goal-Directed Value Profiling

  • Scott Watterson
  • Saumya Debray
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2027)


Compilers can exploit knowledge that a variable has a fixed known value at a program point for optimizations such as code specialization and constant folding. Recent work has shown that it is possible to take advantage of such optimizations, and thereby obtain significant performance improvements, even if a variable cannot be statically guaranteed to have a fixed constant value. To do this profitably, however, it is necessary to take into account information about the runtime distribution of values taken on by variables. This information can be obtained though value profiling. Unfortunately, existing approaches to value profiling incur high overheads, primarily because profiling is carried out without consideration for the way in which the resulting information will be used. In this paper, we describe an approach to reduce the cost of value profiling by making the value profiler aware of the utility of the value profiles being gathered. This allows our profiler to avoid wasting resources where the profile can be guaranteed to not be useful for optimization. This results in significant reductions in both the time and space requirements for value profiling. Our approach, implemented in the context of the alto link-time optimizer, is an order of magnitude faster, and uses about 5% of the space, of a straightforward implementation.


Basic Block Code Specialization Original Code Load Instruction Program Point 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    J. Auslander, M Philipose, C. Chambers, S. Eggers, and B. Bershad. Fast, effectvie dynamic compilation. In SIGPLAN’ 96 Conference on Programming Language Design and Implementation, pages 149–159, May 1996.Google Scholar
  2. 2.
    T. Ball and J. R. Larus, “Optimally Profiling and Tracing Programs”, Proc. 19th. Symposium on Principles of Programming Languages, Jan. 1992.Google Scholar
  3. 3.
    T. Ball and J. R. Larus, “Efficient Path Profiling”, Proc. MICRO-29, Dec. 1996.Google Scholar
  4. 4.
    B. Calder, P. Feller, and A. Eustace. Value profiling. In 30th Annual International Symposium on Microarchitecture, pages 259–269, December 1997.Google Scholar
  5. 5.
    B. Calder, P. Feller, and A. Eustace.Value profiling and optimization. In Journal of Instruction Level Parallelism, 1999.Google Scholar
  6. 6.
    P. P. Chang, S. A. Mahlke, W. Y. Chen, and W. W. Hwu, “Profile-guided automatic inline expansion for C programs”, Software Practice and Experience vol. 22 no. 5, May 1992, pp. 349–369.CrossRefGoogle Scholar
  7. 7.
    R. Cohn and P. G. Lowney, “Hot Cold Optimization of Large Windows/NT Applications”, Proc. MICRO29, Dec. 1996.Google Scholar
  8. 8.
    C. Consel and F. Noel. A general approach to run-time specialization and its application to c. In 23rd Annual ACM Symposium on Principles of Programming Languages, pages 145–146, Jan 1996.Google Scholar
  9. 9.
    D. Engler, W. Hsieh, and M. Kaashoek. ’c:A language for high-level, efficient, and machineindependent dynamic code generation. In 23rd Annual ACM Symposium on Principles of Programming Languages, pages 131–144, Jan 1996.Google Scholar
  10. 10.
    P. Feller. Value profling for instructions and memory locations. Master’s thesis, UCSD, 1998.Google Scholar
  11. 11.
    C. Fu, M. Jennings, S. Larin, and T. Conte. Software-only value speculation scheduling. Technical report, Department of Electrical and Computer Engineering, North Carolina State University, June 1998.Google Scholar
  12. 12.
    F. Gabbay and A. Mendelson. Can program profiling support value prediction? In Proceedings of the 30 th Annual ACM/IEEE International Symposium on Microarchitecture, pages 270–280, Dec 1997.Google Scholar
  13. 13.
    A. J. Goldberg, “ReducingOverhead in Counter-Based Execution Profiling”,Technical Report CSL-TR-91-495, Computer Systems Lab., Stanford University, Oct. 1991.Google Scholar
  14. 14.
    S. S. Muchnick, Advanced Compiler Design and Implementation, Morgan Kaufman, 1997.Google Scholar
  15. 15.
    Robert Muth, Scott Watterson, and Saumya Debray. Code specialization using value profiles. In Static Analysis Symposium, July 2000, pp. 340–359.Google Scholar
  16. 16.
    R. Muth, S. K. Debray, S. Watterson, and K. De Bosschere, “alto: ALink-Time Optimizer for the Compaq Alpha”, Software-Practice and Experience, vol. 31 no. 1, Jan 2001, pp. 67–101.zbMATHCrossRefGoogle Scholar
  17. 17.
    K. Pettis and R. C. Hansen, “Profile-Guided Code Positioning”, Proc. SIGPLAN’ 90 Conference on Programming Language Design and Implementation, June 1990, pp. 16–27.Google Scholar
  18. 18.
    B. Calder and D. Grunwald, “Reducing Indirect Function Call Overhead in C++ Programs”, Proc. 21st ACM Symposium on Principles of Programming Languages, Jan. 1994, pp. 397–408.Google Scholar
  19. 19.
    U. Hölzle and D. Ungar, “Optimizing Dynamically-Dispatched Calls with Run-Time Type Feedback”, Proc. SIGPLAN’ 94 Conference on Programming Language Design and Implementation (PLDI), June 1994, pp. 326–336.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Scott Watterson
    • 1
  • Saumya Debray
    • 1
  1. 1.Department of Computer ScienceUniversity of ArizonaTucson

Personalised recommendations