[LLVMbugs] [Bug 19134] New: code for hot loop in libjpeg is terribad, with lots of reg-to-reg copies

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 13 13:42:15 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19134

            Bug ID: 19134
           Summary: code for hot loop in libjpeg is terribad, with lots of
                    reg-to-reg copies
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: grosbach at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12228
  --> http://llvm.org/bugs/attachment.cgi?id=12228&action=edit
-O0 IR for ycc_rgb_convert()

libjpeg (jpeg-6b) code.

Function ycc_rgb_convert() in jdcolor.c (unoptimized bitcode attached) gets
compiled with the hot inner loop as:
LBB3_5:                                 ## %for.body
                                        ##   Parent Loop BB3_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
    movzbl    (%r13), %esi
    movq    %r14, %r12
    movq    %r10, %r14
    movzbl    (%rdi), %r10d
    movq    %r8, %rdx
    movl    (%rcx,%r10,4), %r8d
    addl    %esi, %r8d
    movq    %rcx, %r11
    movslq    %r8d, %rcx
    movq    %rdx, %r8
    movb    (%r15,%rcx), %cl
    movzbl    (%rbx), %edx
    movb    %cl, (%rax)
    movq    (%r8,%r10,8), %rcx
    movq    %r14, %r10
    movq    %r12, %r14
    addq    (%r14,%rdx,8), %rcx
    shrq    $16, %rcx
    addl    %esi, %ecx
    movslq    %ecx, %rcx
    movb    (%r15,%rcx), %cl
    movb    %cl, 1(%rax)
    addl    (%r10,%rdx,4), %esi
    movslq    %esi, %rcx
    movb    (%r15,%rcx), %cl
    movb    %cl, 2(%rax)
    movq    %r11, %rcx
    incq    %r13
    incq    %rbx
    incq    %rdi
    addq    $3, %rax
    decl    %r9d
    jne    LBB3_5


Note the sequences like:
    movq    %r14, %r10
    movq    %r12, %r14

We're copying around the loop counter and base addresses for no obviously good
reason. Both GCC 4.8.2 and ICC13 do much better here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140313/ffaa23f3/attachment.html>


More information about the llvm-bugs mailing list