This is an archive of the discontinued LLVM Phabricator instance.

[LoopPeeling] Fix condition for phi-eliminating peeling
ClosedPublic

Authored by mkazantsev on Apr 6 2017, 4:15 AM.

Details

Summary

When peeling loops basing on phis becoming invariants, we make a wrong loop size check.
UP.Threshold should be compared against the total numbers of instructions after the transformation,
which is equal to 2 * LoopSize in case of peeling one iteration.
We should also check that the maximum allowed number of peeled iterations is not zero.

Diff Detail

Repository
rL LLVM

Event Timeline

mkazantsev updated this revision to Diff 94362.Apr 6 2017, 6:45 AM
mkazantsev retitled this revision from [LoopPeeling] Fix loop size check for non-forced invariant-based peeling to [LoopPeeling] Fix condition for phi-eliminating .
mkazantsev edited the summary of this revision. (Show Details)
mkazantsev planned changes to this revision.Apr 6 2017, 6:49 AM

Need to add a negative test when the peeling doesn't happen due to UnrollPeelMaxCount = 0.

mkazantsev updated this revision to Diff 94365.Apr 6 2017, 6:58 AM
mkazantsev retitled this revision from [LoopPeeling] Fix condition for phi-eliminating to [LoopPeeling] Fix condition for phi-eliminating peeling.
mkuper accepted this revision.Apr 13 2017, 6:01 PM

LGTM

This revision is now accepted and ready to land.Apr 13 2017, 6:01 PM
This revision was automatically updated to reflect the committed changes.