[PATCH] D27734: [LoopUnroll] Enable PGO-based loop peeling by default

Michael Kuperstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 11:24:44 PST 2017


mkuper added a comment.

In https://reviews.llvm.org/D27734#642276, @anemet wrote:

> Hi Michael,
>
> Is this is on with -Os + PGO or just O<n> + PGO?


This is O<n> (https://reviews.llvm.org/owners/package/2/, really) + PGO.
The peel count computation is limited by UP.Threshold, so we should not see it kick in with default thresholds for -Os + PGO. I'll add a test for that in a separate patch.

> Also I forgot the heuristics from the original patch, are we only peeling hot low-trip count loops or also cold ones?

We will not peel loops that are so cold they're dead. :)
The loop needs to have profile information, so it must have been entered at least once.

Other than that, the current heuristic doesn't distinguish between hot and cold loops. This is rather unfortunate, but I'm not sure how it can be fixed.
Both because using BFI in a loop pass is problematic (hence llvm::getLoopEstimatedTripCount() - although it's also cheaper than computing full BFI just to get the equivalent), and because it's not clear that relative hotness to function entry is the right metric here. Maybe relative hotness to the entire profile?


https://reviews.llvm.org/D27734





More information about the llvm-commits mailing list