]> granicus.if.org Git - llvm/commit
[SLP] respect target register width for GEP vectorization (PR43578)
authorSanjay Patel <spatel@rotateright.com>
Wed, 9 Oct 2019 16:32:49 +0000 (16:32 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 9 Oct 2019 16:32:49 +0000 (16:32 +0000)
commit006958b5ff50c846f3d89ac2b72ef476a58c23b8
treeb41fc9fd81b4d8a1bd525c421accb6f7bc9b5e25
parentf4f16f170b82f537e98ec5c0d55455c089550346
[SLP] respect target register width for GEP vectorization (PR43578)

We failed to account for the target register width (max vector factor)
when vectorizing starting from GEPs. This causes vectorization to
proceed to obviously illegal widths as in:
https://bugs.llvm.org/show_bug.cgi?id=43578

For x86, this also means that SLP can produce rogue AVX or AVX512
code even when the user specifies a narrower vector width.

The AArch64 test in ext-trunc.ll appears to be better using the
narrower width. I'm not exactly sure what getelementptr.ll is trying
to do, but it's testing with "-slp-threshold=-18", so I'm not worried
about those diffs. The x86 test is an over-reduction from SPEC h264;
this patch appears to restore the perf loss caused by SLP when using
-march=haswell.

Differential Revision: https://reviews.llvm.org/D68667

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374183 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/SLPVectorizer.cpp
test/Transforms/SLPVectorizer/AArch64/ext-trunc.ll
test/Transforms/SLPVectorizer/AArch64/getelementptr.ll
test/Transforms/SLPVectorizer/X86/load-merge.ll