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

            Bug ID: 21115
           Summary: Performance regression caused by changes in machine
                    sink
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified

Created attachment 13108
  --> http://llvm.org/bugs/attachment.cgi?id=13108&action=edit
Test

After changes in revision 216862 I see performance regression at least on x86
Silvermont on attached test case.
To reproduce compile it with:
llc -O2 -mcpu=slm test.ll

The reason of regression is machine sink doesn't move some add operations out
of loop:

Revision 216861:
    addl    %edx, %ebx
    addl    $1, %esi
    addl    %ebp, %ecx
    cmpl    $512, %ebx              # imm = 0x200
    jl    .LBB0_5                 <--- Back edge
# BB#6:                                 # %for.cond4.for.end_crit_edge
                                        #   in Loop: Header=BB0_4 Depth=2
    movl    20(%esp), %edx          # 4-byte Reload
    leal    (%edx,%ecx), %edi       <--- add moved out of loop 
    movl    16(%esp), %edx          # 4-byte Reload
    movl    %edi, t_run_test.imagHi_1
    leal    (%edx,%ecx), %ebp       <--- add moved out of loop
    movl    %esi, %edx
    movl    %eax, %esi
    movl    12(%esp), %eax          # 4-byte Reload
    movl    %ebp, t_run_test.realHi_1
    addl    %ecx, %eax              <--- add moved out of loop
    addl    8(%esp), %ecx           # 4-byte Folded Reload   <--- add moved out
of loop
    movl    %eax, t_run_test.imagLow_1
    movl    %esi, %eax
    movl    %edx, %esi
    movl    4(%esp), %edx           # 4-byte Reload
    movl    %ecx, t_run_test.realLow_1

Revision 21862:
    cmpl    $512, %ecx              # imm = 0x200
    leal    (%eax,%ebx), %ebp       <--- add inside loop
    movl    24(%esp), %eax          # 4-byte Reload
    leal    (%edx,%ebx), %edx       <--- add inside loop
    leal    (%edi,%ebx), %edi       <--- add inside loop
    leal    (%eax,%ebx), %eax       <--- add inside loop
    jl    .LBB0_5                 <--- Back edge
# BB#6:                                 # %for.cond4.for.end_crit_edge
                                        #   in Loop: Header=BB0_4 Depth=2
    movl    %edi, t_run_test.realLow_1
    movl    %edx, t_run_test.imagLow_1
    movl    %eax, t_run_test.realHi_1
    movl    %ebp, t_run_test.imagHi_1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to