[PATCH] D73398: In SCEV's printer pass, print an estimate of the exit count for each exit from profiling information

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 13:48:17 PST 2020


nikic added a comment.

What you're doing here is right for a single exit, but I don't think it holds up for multiple exits. Talking in terms of probabilities, you are given `P(E_i | not E_{i-1})`, where `E_i` is the event that exit i is taken. The non-conditional exit probability is `P(E_i) = P(E_i | not E_{i-1}) / P(not E_{i-1})`. The predicted exit count is `(1 / P(E_i)) - 1`.

To get accurate exit counts, you'd have to walk down the chain of (dominating) exits and adjust probabilities/weights as you go along.

Am I overthinking things?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73398/new/

https://reviews.llvm.org/D73398





More information about the llvm-commits mailing list