[PATCH] D25963: [LoopUnroll] Implement profile-based loop peeling

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 19:08:42 PDT 2016


hfinkel added a comment.

As a high-level comment, it would be nice to also have loop metadata to specify a typical trip count (or trip counts).

Intel, for example has (https://software.intel.com/en-us/node/524502):

  #pragma loop_count(n)

which asks the optimizer to optimize for a trip count of n. Moreover, and perhaps more importantly, is also supports:

  #pragma loop_count(n1, n2, ...)

which asks for specializations for trip counts n1, n2, etc.

Also supported by Intel's compiler is:

  #pragma loop_count min(n),max(n),avg(n)

(in this case, avg is a hint, but min and max are promises).

FWIW, obviously part of the problem with the average is that you might miss the common trip counts. A loop that is generally executed with a trip count of 3 or 5, might end up with a average near 4; I'm not sure what the best thing would be to do in that case.


https://reviews.llvm.org/D25963





More information about the llvm-commits mailing list