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

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 13:54:05 PST 2025


================
@@ -124,6 +130,8 @@ void AMDGPUTTIImpl::getUnrollingPreferences(
   // We want to run unroll even for the loops which have been vectorized.
   UP.UnrollVectorizedLoop = true;
 
+  UP.AllowExpensiveTripCount = UnrollRuntimeExpensiveTripCount;
----------------
carlobertolli wrote:

I see two places that set the related boolean var to true:
    if (UserUnrollCount || (PragmaCount > 0)) {

and

  if (L->getHeader()->getParent()->hasProfileData()) {

in LoopUnrollPass.cpp

I see two other targets that set it, IBM's P and Z systems. I can't see a top level flag for this.
Agreed that proliferation of this at target level is undesirable, but there isn't an alternative right now. 


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


More information about the llvm-commits mailing list