llvm-project
4b5a4b05 - [LoopUnroll] Enable allowexpensivetripcounts when user provides pragma (#181267)

Commit
17 days ago
[LoopUnroll] Enable allowexpensivetripcounts when user provides pragma (#181267) Loops with an explicit unroll pragma (`#pragma unroll` / `#pragma clang loop unroll(enable)`) that have an expensive runtime trip count currently don't get unrolled because `UP.AllowExpensiveTripCount` defaults to false. The pragma is silently ignored. This is not the case when an unroll factor is specified (`PragmaCount > 0`), where the pass sets `UP.AllowExpensiveTripCount = true`. **Solution:** Set `UP.AllowExpensiveTripCount` and `UP.Runtime` to true for for loops that have an unroll pramga at the beginning of `computeUnrollCount()`. I've also added a new lit test `expensive-tripcount.ll` that verifies pragma-driven unrolling with expensive trip counts will work as expected. --------- Co-authored-by: Justin Fargnoli <jfargnoli@nvidia.com>
Author
Parents
Loading