[llvm] [LoopUnroll] Introduce PragmaUnrollFullMaxIterations as a hard cap on how many iterations we try to unroll (PR #78648)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 11:39:30 PST 2024


modiking wrote:

> we're seeing a failure with this patch internally (don't have a reproducer yet, just letting you know in case it's actionable in the mean time while we continue investigating)
> 
> An existing loop with a static bound (256) with a `#pragma unroll` worked without the patch, but the resulting program times out with this patch applied. Putting an explicit bound on the unroll (which should be identical to the static bound in the loop) like `#pragma unroll 256` doesn't time out anymore.
> 
> The contents of the loop does include a couple of gotos, a continue and a return (all under various conditions), if that's relevant/helpful.

Interesting, no certainty on the answer here but there's 2 changes here:
1. Detect super high full unroll and bail
2. Add an additional condition on `loop-unroll-full` phase that blocks it from partially unrolling in certain cases (`UP.Count < TripCount`)

Could be worthwhile to see which one of these is causing the issue.

https://github.com/llvm/llvm-project/pull/78648


More information about the llvm-commits mailing list