[PATCH] D43256: [MBP] Move a latch block with conditional exit and multi predecessors to top of loop

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 21:53:51 PDT 2019


ebrevnov added a comment.

In D43256#1601744 <https://reviews.llvm.org/D43256#1601744>, @Carrot wrote:

> @ebrevnov, it's better to provide a reproducer. Otherwise I can't analyze the problem that impacts your code. Four is not a big number.


Four is not big, but who knows how many other cases will arise. I was looking to another case with ~%5 regression. As I mentioned, sources are not available for this case and I was not able to identify anything special just looking into assembler.  As in previous case we have one extra jump which accounts for about 3.5% instructions of the loop. Here is an assembler for the loop after optimization:

  23001bf40:   4c8975 movq    %r14, -72(%rbp)
  23001bf44:   4c894d movq    %r9, -48(%rbp)
  23001bf48:   48894d movq    %rcx, -56(%rbp)
  23001bf4c:   4c8945 movq    %r8, -64(%rbp)
  23001bf50:   48895d movq    %rbx, -80(%rbp)
  23001bf54:   4889cf movq    %rcx, %rdi
  23001bf57:   90     nop
  23001bf58:   e863f1 callq    -69277                       ; 0x3000b0c0
  23001bf5d:   4c8b75 movq    -72(%rbp), %r14
  23001bf61:   488b4d movq    -56(%rbp), %rcx
  23001bf65:   4c8b4d movq    -48(%rbp), %r9
  23001bf69:   4c8b45 movq    -64(%rbp), %r8
  23001bf6d:   48ffc3 incq    %rbx
  23001bf70:   410fb6 movzbl    148(%r9), %eax
  23001bf78:   84c0   testb    %al, %al
  23001bf7a:   7572   jne    114                            ; 0x3001bfee
  23001bf7c:   498b04 movq    (%r12), %rax
  23001bf80:   498b55 movq    (%r13), %rdx
  23001bf84:   4885c2 testq    %rax, %rdx
  23001bf87:   751b   jne    27                             ; 0x3001bfa4
  23001bf89:   488b78 movq    16(%rax), %rdi
  23001bf8d:   4885fa testq    %rdi, %rdx
  23001bf90:   7526   jne    38                             ; 0x3001bfb8
  23001bf92:   f64708 testb    $1, 8(%rdi)            ; 0x3001bfd4
  23001bf96:   be5f49 movl    $346463, %esi
  23001bf9b:   74a3   je    -93                             ; 0x3001bf40
  23001bf9d:   be8b10 movl    $4235, %esi
  23001bfa2:   eb9c   jmp    -100                           ; 0x3001bf40

Thanks
Evgeniy


Repository:
  rL LLVM

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

https://reviews.llvm.org/D43256





More information about the llvm-commits mailing list