The inline cost analysis used the cold attribute but only when
ProfileSummaryInfo was available even though that attribute isn't part
of the profile info for the module and is independently available.
This patch lifts the check up into the generic cold callsite detection
logic as for *cold* functions, we routinely treat *all* call sites as
cold. In fact, we shape the probabilities and frequencies this way if
there is any CFG, but sometimes (such as single-basic-block functions)
there isn't any CFG that can exhibit this. Moreover, it seems much
simpler and direct to just query for the cold attribute and be done with
it, skipping all of the probability queries.
This also simplifies what is necessary to write a test using the cold
attribute as now you don't have to remember to run the
profile-summary-info analysis in the new PM. I spent quite some time
confused because I didn't have that analysis around.
Also remove the redundant thresholds between the two ways of detecting
cold calls. Originally there was some concern that we would want to tune
these thresholds independently but so far no such need has arisen and it
is easy enough to add back in. I'd rather have the simpler system in the
interim that is also easier to understand and reason about.
This should be essentially a no-op for most users of LLVM, but will
result in an API simplification and a test simplification.
IIRC, static branch prediction already handles this case. Do you see missing cases?