This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by skatkov on Jul 31 2019, 1:53 AM.

Details

Reviewers
reames
fhahn
Summary

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.

Diff Detail