[PATCH] D104590: [LoopUnroll] Don't modify TripCount/TripMultiple in computeUnrollCount()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 19 11:14:07 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp:1166
   // Unroll factor (Count) must be less or equal to TripCount.
   if (TripCount && UP.Count > TripCount)
     UP.Count = TripCount;
----------------
reames wrote:
> I may be missing something, but I think you're changing behavior here.  computeUnrollCount appears to indirectly control ULO.Count via this line.  Unless I'm misreading this?  If I'm not, I'm surprised tests don't cover this.  
I think this is just dead code and have dropped it. UnrollLoop() will clamp the unroll count to the max trip count itself, so this is redundant.

Note that TripCount and TripMultiple are also used in the UP.Runtime adjustment below, but computeUnrollCount() only changes TripCount and TripMultiple when fully unrolling, so it shouldn't matter for runtime unrolling.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104590/new/

https://reviews.llvm.org/D104590



More information about the llvm-commits mailing list