Value Profiling for Instructions and Memory Locations

Peter Feller

UC San Diego Technical Report CS1998-581, April 1998

Abstract:

Identifying variables as invariant or constant at compile-time allows the compiler to perform optimizations including constant folding, code specialization, and partial evaluation. Some variables, which cannot be labeled as constants, may exhibit semi-invariant behavior. A semi-invariant variable is one that cannot be identified as a constant at compile-time, but has a high degree of invariant behavior at run-time. If run-time information was available to identify these variables as semi-invariant, they could then benefit from invariant-based compiler optimizations.

In this thesis the value behavior and invariance found from profiling register-defining instructions and memory locations, as well as their differences, are analyzed. Many instructions and memory locations have semi-invariant values even across different inputs. In addition, the predictability of register values and memory location values using a Last-Value-Prediction (LVP) scheme is investigated. The ability to estimate the invariance for all instructions in a program from only profiling load instructions is examined, and an intelligent form of sampling called Convergent Profiling is introduced to reduce the profiling time needed to generate an accurate value profile.

A value profile can be used to automatically guide code generation for dynamic compilation, adaptive execution, code specialization, partial evaluation and other compiler optimizations. Using value profile information to perform code specialization is shown to decrease execution time up to 13%.