This is an archive of the discontinued LLVM Phabricator instance.

Don't unroll loops in loop vectorization pass when VF is one.
ClosedPublic

Authored by wmi on Apr 13 2015, 2:37 PM.

Details

Summary

The patch is to fix the problem described in https://llvm.org/bugs/show_bug.cgi?id=23217

The problem is: When loop vectorization decide not to vectorize a loop (VF==1), it may still unroll the loop. However, the unroll factor may be smaller than the factor computed in loop unroll pass, so loop unroll pass may unroll the already unrolled loop once more and unroll the remainder loop at the same time.

I don't see the benefit of unrolling when VF==1. The patch is to disable the unrolling when VF==1 in loop vectorization pass, and let loop unroll pass to do the unrolling for such loop.

Performance neutral for spec2000. Google internal benchmarks: detection improved by 5% on sandybridge and 9% on westmere, saw improved by 1.5% on both platforms.

Diff Detail

Repository
rL LLVM

Event Timeline

wmi updated this revision to Diff 23696.Apr 13 2015, 2:37 PM
wmi retitled this revision from to Don't unroll loops in loop vectorization pass when VF is one..
wmi updated this object.
wmi edited the test plan for this revision. (Show Details)
wmi added a reviewer: hfinkel.
wmi set the repository for this revision to rL LLVM.
wmi added a subscriber: Unknown Object (MLST).
wmi updated this revision to Diff 24098.Apr 20 2015, 10:06 PM

Update the patch to disable interleave in loop vectorizer when VF==1 only for x86 architecture.
Update test/Transforms/LoopVectorize/X86/unroll-small-loops.ll.

This revision was automatically updated to reflect the committed changes.
hfinkel edited edge metadata.May 5 2015, 7:31 PM
In D9007#162733, @wmi wrote:

Ping.

What's going on here? This is a closed review for something it claims was already committed. Did you upload the patch to the wrong place?

wmi added a comment.May 5 2015, 8:20 PM

Sorry, my bad. I mistakenly used the review number here in another
commit. This patch is still pending for review.

Wei.

In D9007#166472, @wmi wrote:

Sorry, my bad. I mistakenly used the review number here in another
commit. This patch is still pending for review.

Okay, can you please repost with the correct summary?

Wei.

llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp