[all-commits] [llvm/llvm-project] fc9c59: [SLP]Do not emit extract elements for insertelemen...

Andrew V. Tischenko via All-commits all-commits at lists.llvm.org
Fri May 20 06:00:36 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc9c59c355cb255446e571b4515b5e41a76503c4
      https://github.com/llvm/llvm-project/commit/fc9c59c355cb255446e571b4515b5e41a76503c4
  Author: Alexey Bataev <a.bataev at outlook.com>
  Date:   2022-05-20 (Fri, 20 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Transforms/SLPVectorizer/AArch64/loadorder.ll
    M llvm/test/Transforms/SLPVectorizer/AArch64/transpose-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/AArch64/transpose.ll
    M llvm/test/Transforms/SLPVectorizer/AArch64/tsc-s116.ll
    M llvm/test/Transforms/SLPVectorizer/X86/buildvector-same-lane-insert.ll
    M llvm/test/Transforms/SLPVectorizer/X86/buildvector-shuffle.ll
    M llvm/test/Transforms/SLPVectorizer/X86/cmp-as-alternate-ops.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_bullet3.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_cmpop.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_exceed_scheduling.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_lencod.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_scheduling-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_scheduling.ll
    M llvm/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll
    M llvm/test/Transforms/SLPVectorizer/X86/extractelement.ll
    M llvm/test/Transforms/SLPVectorizer/X86/horizontal-list.ll
    M llvm/test/Transforms/SLPVectorizer/X86/horizontal-minmax.ll
    M llvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll
    M llvm/test/Transforms/SLPVectorizer/X86/insert-shuffle.ll
    M llvm/test/Transforms/SLPVectorizer/X86/jumbled-load-multiuse.ll
    M llvm/test/Transforms/SLPVectorizer/X86/jumbled-load.ll
    M llvm/test/Transforms/SLPVectorizer/X86/jumbled_store_crash.ll
    M llvm/test/Transforms/SLPVectorizer/X86/load-merge-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/X86/load-merge.ll
    M llvm/test/Transforms/SLPVectorizer/X86/lookahead.ll
    M llvm/test/Transforms/SLPVectorizer/X86/ordering-bug.ll
    M llvm/test/Transforms/SLPVectorizer/X86/phi.ll
    M llvm/test/Transforms/SLPVectorizer/X86/pr42022-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/X86/pr42022.ll
    M llvm/test/Transforms/SLPVectorizer/X86/reduction-same-vals.ll
    M llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
    M llvm/test/Transforms/SLPVectorizer/X86/reorder_diamond_match.ll
    M llvm/test/Transforms/SLPVectorizer/X86/reordered-top-scalars.ll
    M llvm/test/Transforms/SLPVectorizer/X86/vec_list_bias-inseltpoison.ll
    M llvm/test/Transforms/SLPVectorizer/X86/vec_list_bias.ll
    M llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll

  Log Message:
  -----------
  [SLP]Do not emit extract elements for insertelements users, replace with shuffles directly.

SLP vectorizer emits extracts for externally used vectorized scalars and
estimates the cost for each such extract. But in many cases these
scalars are input for insertelement instructions, forming buildvector,
and instead of extractelement/insertelement pair we can emit/cost
estimate shuffle(s) cost and generate series of shuffles, which can be
further optimized.

Tested using test-suite (+SPEC2017), the tests passed, SLP was able to
generate/vectorize more instructions in many cases and it allowed to reduce
number of re-vectorization attempts (where we could try to vectorize
buildector insertelements again and again).

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




More information about the All-commits mailing list