[PATCH] D114171: [SLP]Improve reductions analysis and emission, part 1.

Alexander Kornienko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 10:36:11 PDT 2022


alexfh added a comment.

No reduced test case, but one observation is that most samples in the slow version are around this (preexisting code):

  // The reduction nodes (stored in UserIgnoreList) also should stay scalar.
  for (Value *V : VL) {
    if (is_contained(UserIgnoreList, V)) {



   0.00 │ 7aa:   testq   %rdx, %rdx                                                                                                                                                                                                                  ▒
        │        leaq    -536(%rbp), %r15                                                                                                                                                                                                            ▒
        │      ; llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4296                                                                                                                                   ▒
        │      ;   for (Value *V : VL) {                                                                                                                                                                                                             ◆
        │      ↓ je      80a                                                                                                                                                                                                                         ▒
        │        movq    -80(%rbp), %rax                                                                                                                                                                                                             ▒
        │        movq    2088(%rax), %rbx                                                                                                                                                                                                            ▒
        │        movq    2096(%rax), %rcx                                                                                                                                                                                                            ▒
        │        leaq    (%rbx,%rcx,8), %r10                                                                                                                                                                                                         ▒
        │        leaq    (,%rcx,8), %r8                                                                                                                                                                                                              ▒
        │      ↓ jmp     7e8                                                                                                                                                                                                                         ▒
        │      ; llvm-project/llvm/include/llvm/ADT/STLExtras.h:1671                                                                                                                                                 ▒
        │      ;   return std::find(adl_begin(Range), adl_end(Range), Element) != adl_end(Range);                                                                                                                                                    ▒
        │ 7d6:   cmpq    %r10, %rax                                                                                                                                                                                                                  ▒
        │      ; llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4297                                                                                                                                   ▒
        │      ;     if (is_contained(UserIgnoreList, V)) {                                                                                                                                                                                          ▒
        │      ↓ jne     a98                                                                                                                                                                                                                         ▒
        │      ; llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4296                                                                                                                                   ▒
        │      ;   for (Value *V : VL) {                                                                                                                                                                                                             ▒
   0.12 │ 7df:   addq    $8, %rsi                                                                                                                                                                                                                    ▒
   0.01 │        cmpq    %r9, %rsi                                                                                                                                                                                                                   ▒
        │      ↓ je      80a                                                                                                                                                                                                                         ▒
        │ 7e8:   movq    %rbx, %rax                                                                                                                                                                                                                  ▒
        │        testq   %rcx, %rcx                                                                                                                                                                                                                  ▒
        │      ; include/c++/v1/__algorithm/find.h:24                                                                                                                               ▒
        │      ;   for (; __first != __last; ++__first)                                                                                                                                                                                              ▒
        │      ↑ je      7d6                                                                                                                                                                                                                         ▒
   0.10 │        movq    (%rsi), %rdi                                                                                                                                                                                                                ▒
        │        movq    %r8, %rdx                                                                                                                                                                                                                   ▒
        │        movq    %rbx, %rax                                                                                                                                                                                                                  ▒
        │      ; include/c++/v1/__algorithm/find.h:25                                                                                                                               ▒
        │      ;     if (*__first == __value_)                                                                                                                                                                                                       ▒
  99.02 │ 7f9:   cmpq    %rdi, (%rax)                                                                                                                                                                                                                ▒
        │      ↑ je      7d6                                                                                                                                                                                                                         ▒
        │      ; include/c++/v1/__algorithm/find.h:24                                                                                                                               ▒
        │      ;   for (; __first != __last; ++__first)                                                                                                                                                                                              ▒
        │        addq    $8, %rax                                                                                                                                                                                                                    ▒
        │        addq    $-8, %rdx                                                                                                                                                                                                                   ▒
   0.03 │      ↑ jne     7f9                                                                                                                                                                                                                         ▒
   0.28 │      ↑ jmp     7df                                                                                                                                                                                                                         ▒
        │      ; llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:4308                                                                                                                                   ▒
        │      ;   auto *VL0 = cast<Instruction>(S.OpValue);                                                                                                                                                                                         ▒
        │ 80a:   movq    -136(%rbp), %r14                                                                                                                                                                                                            ▒


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114171/new/

https://reviews.llvm.org/D114171



More information about the llvm-commits mailing list