[PATCH] D103748: [LoopUnroll] Clamp unroll count to MaxTripCount

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 5 02:47:29 PDT 2021


nikic created this revision.
nikic added a reviewer: reames.
Herald added subscribers: zzheng, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Unrolling with more iterations than `MaxTripCount` is pointless, as those iterations can never be executed. As such, we clamp `ULO.Count` to `MaxTripCount` if it is known. This means we no longer need to consider iterations after MaxTripCount for exit folding, and the CompletelyUnroll flag becomes independent of `ULO.TripCount`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103748

Files:
  llvm/lib/Transforms/Utils/LoopUnroll.cpp
  llvm/test/Transforms/LoopUnroll/multiple-exits.ll
  llvm/test/Transforms/LoopUnroll/nonlatchcondbr.ll
  llvm/test/Transforms/LoopUnroll/runtime-loop5.ll
  llvm/test/Transforms/LoopUnroll/runtime-small-upperbound.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103748.350048.patch
Type: text/x-patch
Size: 26486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210605/c6bc63bf/attachment.bin>


More information about the llvm-commits mailing list