title: Semantics of GCC hot attribute
body: <p>Assume I have a compilation unit consisting of three functions, A, B, and C.  A is invoked once from a function external to the compilation unit (e.g. it's an entry point or callback); B is invoked many times by A (e.g. it's invoked in a tight loop); C is invoked once by each invocation of B (e.g. it's a library function).</p>
  
  <p>The entire path through A (passing through B and C) is performance-critical, though the performance of A itself is non-critical (as most time is spent in B and C).</p>
  
  <p>What is the minimal set of functions which one should annotate with <code>__attribute__ ((hot))</code> to effect more aggressive optimization of this path?  Assume we cannot use <code>-fprofile-generate</code>.</p>
  
  <p>Equivalently: Does <code>__attribute__ ((hot))</code> mean "optimize the body of this function", "optimize calls to this function", "optimize all descendant calls this function makes", or some combination thereof?</p>
  
  <p>The GCC info page does not clearly address these questions.</p>