[PATCH] D80080: [LoopUnroll] Do not peel loop if we also completely unroll.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 17 06:23:02 PDT 2020


fhahn created this revision.
fhahn added reviewers: efriedma, hfinkel, davide.
Herald added subscribers: zzheng, hiraditya.
Herald added a project: LLVM.

Currently we do not adjust ULO.Count after peeling. If we completely
unroll a loop, this means we will end up executing TripCount + PeelCount
number of iterations, instead of TripCount iterations.
There is no point in peeling, if we completely unroll a loop, so we can
just skip it. Alternatively we could adjust ULO.Count, but skipping
peeling should result in a bit less work.

When not completely unrolling a loop, we should be fine, as ULO.TripCount
and ULO.TripCountMultiple are adjusted already.

Fixes PR45939.

Note the adjustments in PR33437, which are due to not peeling in this
case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80080

Files:
  llvm/lib/Transforms/Utils/LoopUnroll.cpp
  llvm/test/Transforms/LoopUnroll/pr33437.ll
  llvm/test/Transforms/LoopUnroll/pr45939-peel-count-and-complete-unroll.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80080.264487.patch
Type: text/x-patch
Size: 14695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200517/4324fa2c/attachment.bin>


More information about the llvm-commits mailing list