]> granicus.if.org Git - llvm/commit
[Loop Peeling] Do not close further unroll/peel if profile based peeling was not...
authorSerguei Katkov <serguei.katkov@azul.com>
Fri, 2 Aug 2019 04:29:23 +0000 (04:29 +0000)
committerSerguei Katkov <serguei.katkov@azul.com>
Fri, 2 Aug 2019 04:29:23 +0000 (04:29 +0000)
commitbe5ae1bbe6783dc43a632f92395ef3d443132fa9
treed298afc2cd2c0d7d7420625b8a70fa160f03aa21
parentc39a6e682d1139836142ed882c3ceed906005f1e
[Loop Peeling] Do not close further unroll/peel if profile based peeling was not used.

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.

Reviewers: reames, fhahn
Reviewed By: reames
Subscribers: hiraditya, zzheng, dmgreen, llvm-commits
Differential Revision: https://reviews.llvm.org/D64972

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367647 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/TargetTransformInfo.h
lib/Transforms/Scalar/LoopUnrollPass.cpp
lib/Transforms/Utils/LoopUnrollPeel.cpp
test/Transforms/LoopUnroll/peel-loop-conditions-pgo-1.ll [new file with mode: 0644]
test/Transforms/LoopUnroll/peel-loop-conditions-pgo-2.ll [new file with mode: 0644]
test/Transforms/LoopUnroll/peel-loop-conditions.ll