[llvm] Add flag to enable expensive trip counts for runtime unroll. (PR #171735)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 30 06:49:12 PST 2026


================
@@ -178,6 +178,11 @@ static cl::opt<unsigned> PragmaUnrollFullMaxIterations(
     "pragma-unroll-full-max-iterations", cl::init(1'000'000), cl::Hidden,
     cl::desc("Maximum allowed iterations to unroll under pragma unroll full."));
 
+static cl::opt<bool> UnrollRuntimeExpensiveTripCount(
----------------
carlobertolli wrote:

Pytorch does have #pragma unroll on the loop, but opt refuses to unroll the loop due to SCEV budget constraints.
This flag forces opt to unroll the loop.
I would be happy to force opt to always unroll when a pragma is present, no matter what analysis the compiler can come up with: if the user wrote "unroll" on a loop, then the compiler should do it no matter what. Is this what your are suggesting we do?

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


More information about the llvm-commits mailing list