Kinds of profile info in compiler

GCC does have support for

  1. edge profile:
    • Every basic block is associated with relative frequency within function, every edge has a probability that control flow from its source block will follow to edge.

      With profile feedback absolute counts are available and frequencies and probabilities just represent same information re-scaled to common base. Without profile feedback set of static branch prediction algorithms are used to guess the profile. Resulting profile is good on identifying hottest parts of function, but in general it tends to be more flat. It has no use to drive some, such as loop unrolling (ie all loops are predicted to execute relatively few times unless the number of iterations is known at compile time). It still works well for optimization deciding to slow one code path on cost of other (regalloc of superblock formation) or to conservatively identify what parts of function are cold and should not be optimized.

  2. function level profile
    • At the moment functions are coarsely divided into hot, normal and unlikely executed. With profile feedback, unlikely executed are functions with counts 0, hot are functions containing basic blocks with large counts. Without profile feedback attributes hot and cold can be used to control the status. IPA analysis can be used to discover more (such as static constructors/destructors or functions that make program to exit or do error handling or always call other cold function) in future.

Language level support for specifying hotness/coldness

Using hot/cold predicates to trottle code expanding optimizations

None: PDO (last edited 2008-04-09 09:23:49 by r9eq156)