With this patch the getLoopEstimatedTripCount function will
accept also the loops where there are more than one exit but
all exits except latch block should ends up with a call to deopt.
This side exits should not impact the estimated trip count.
Differential D64553
[LoopUtils] Extend the scope of getLoopEstimatedTripCount skatkov on Jul 11 2019, 3:32 AM. Authored by
Details With this patch the getLoopEstimatedTripCount function will This side exits should not impact the estimated trip count.
Diff Detail Event Timeline
Comment Actions The tests using this functionality can be found in https://reviews.llvm.org/D63923 and https://reviews.llvm.org/D64618 or you need a separate unit test? Comment Actions LGTM w/required fix before submit.
|
Would it make sense to remove the restriction of having a single exit block/only deopt non latch exit by generalizing the function?
Wouldn't' it be reasonable to estimate the trip count by summing up the weights of all exit edges and dividing by the weight of the back-edge to the header? That should naturally cover the deopt cases as well, as they should have very low weights, right?
In any case, we should also update the doc-comment in the header describing the new behavior.