[PATCH] D65503: [Loop Peeling] Do not close further unroll/peel if profile based peeling was not used. Alternate to D64972

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 01:54:29 PDT 2019


skatkov created this revision.
skatkov added reviewers: reames, fhahn.
Herald added subscribers: dmgreen, zzheng, hiraditya.
Herald added a project: LLVM.
skatkov added a parent revision: D65501: [Loop Peeling] Introduce peeling levels.

Current peeling cost model can decide to peel off not all iterations
but only some of them to eliminate conditions on phi. At the same time 
if any peeling happens the door for further unroll/peel optimizations on that
loop closes because the part of the code thinks that if peeling happened
it is profile based peeling and all iterations are peeled off.

To resolve this inconsistency the patch provides the flag which states whether
the full peeling basing on profile is enabled or not and peeling cost model
is able to modify this field like it does not PeelCount.

In a separate patch I will introduce an option to allow/disallow peeling basing
on profile.

To avoid infinite loop peeling the patch tracks the total number of peeled iteration
through llvm.loop.peeled.count loop metadata.


https://reviews.llvm.org/D65503

Files:
  llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
  llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
  llvm/test/Transforms/LoopUnroll/peel-loop-conditions-pgo-1.ll
  llvm/test/Transforms/LoopUnroll/peel-loop-conditions-pgo-2.ll
  llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65503.212534.patch
Type: text/x-patch
Size: 7347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190731/9b3abf22/attachment.bin>


More information about the llvm-commits mailing list