Utility analysis that determines what values are worth profiling.
The actual logic is inside the ValueProfileCollectorImpl, whose job is to populate the Candidates vector.
Value profiling an expression means to track the values that this expression takes at runtime and the frequency of each value. It is important to distinguish between two sets of value profiles for a particular expression: 1) The set of values at the point of evaluation. 2) The set of values at the point of use. In some cases, the two sets are identical, but it's not unusual for the two to differ.
To elaborate more, consider this C code, and focus on the expression nn
: void foo(int nn, bool b) { if (b) memcpy(x, y, nn); } The point of evaluation can be as early as the start of the function, and let's say the value profile for nn
is: total=100; (value,freq) set = {(8,10), (32,50)} The point of use is right before we call memcpy, and since we execute the memcpy conditionally, the value profile of nn
can be: total=15; (value,freq) set = {(8,10), (4,5)}
For this reason, a plugin is responsible for computing the insertion point for each value to be profiled. The CandidateInfo
structure encapsulates all the information needed for each value profile site.
Definition at line 57 of file ValueProfileCollector.h.