https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85799

--- Comment #4 from Jan Hubicka <hubicka at ucw dot cz> ---
> I believe inlining is happening too late for it to have an effect - we are
> early inlining a body which has the __builtin_expect replaced by nothing.
> 
> Iff the expected outcome is "constant" a new function attribute would work.
> For outcome dependent on context that wouldn't work.
> 
> Not sure if we can simply introduce a return-value predictor that survives
> inlining?  Honza?

with martin we added strip_predict_hints to the end of early optimization queue
at https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01573.html
this removes the hint and it is not used by the branch prediction of the outer
function.  The statement predictors are somewhat problematic here becuase they
may associate with wrong conditional if the inner function body is optimized.

I guess we have two options
 1) do not re-do branch prediction on inlined code.
 2) strip just selected hints and not others (like builtin_expect) that is
    safe even after inlning.
Not sure which one is better...

Honza
> 
> -- 
> You are receiving this mail because:
> You are on the CC list for the bug.

Reply via email to