This is an archive of the discontinued LLVM Phabricator instance.

[LoopVectorize][X86] Clamp interleave factor if we have a known constant trip count that is less than VF*interleave
ClosedPublic

Authored by craig.topper on Aug 7 2019, 12:24 PM.

Details

Summary

If we know the trip count, we should make sure the interleave factor won't cause the vectorized loop to exceed it.

Improves one of the cases from PR42674

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Aug 7 2019, 12:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2019, 12:24 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn added inline comments.Aug 7 2019, 12:47 PM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
5139 ↗(On Diff #213966)

It might be slightly less code if we set MaxInterleaveCount = TC / VF; before line 5137, if TC > 0. TC / VF should always be >= 1. It might be worth adding an assertion to make sure we don't miss any cases.

Factor TC/VF into MaxInterLeaveCount. Add assert that TC >= VF

fhahn accepted this revision.Aug 7 2019, 2:15 PM

LGTM, thanks.

This revision is now accepted and ready to land.Aug 7 2019, 2:15 PM
This revision was automatically updated to reflect the committed changes.