This is somewhat limited at this point - there are two known sources of inaccuracy:
- We still don't have a code duplication factor, so, for sampling-based FDO, we'll get the wrong trip count if the loop was vectorized in the sampled binary.
- Loops that are dynamically dead in the profile will still be vectorized, since getLoopEstimatedTripCount() still can't distinguish "loop was never entered" from "no information".
Both of these will need to be fixed on the "estimate trip count" side.
Dehao, David, do you think it's worth waiting with this until we have the duplication factors?
This looks like a reusable/common utility function (combine static count and profile count). Probably extract it out?