https://llvm.org/bugs/show_bug.cgi?id=23202

            Bug ID: 23202
           Summary: Registers are moved around in do{}while(); loop
           Product: libraries
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 14189
  --> https://llvm.org/bugs/attachment.cgi?id=14189&action=edit
The whole function

The loop:
        do{
            previous = next;
            in_pos++;
            *out_pos++ = previous;
            if(in_pos == in_limit)
                goto end;
            next = *in_pos;
        }while(previous != next);

is translateted with -O2 to:

.LBB0_3:                                #   Parent Loop BB0_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
    #DEBUG_VALUE: xrle_compress:out <- R14
    #DEBUG_VALUE: xrle_compress:repeat <- 1
    mov    rax, rdi
    mov    rcx, rsi
    mov    r13, rdx
    add    r13, 16
    mov    qword ptr [rbx], rax
    cmp    r12, rcx
    je    .LBB0_4
# BB#7:                                 #   in Loop: Header=BB0_3 Depth=2
    #DEBUG_VALUE: xrle_compress:out <- R14
    #DEBUG_VALUE: xrle_compress:repeat <- 1
    mov    rdi, qword ptr [rcx]
    #DEBUG_VALUE: xrle_compress:next <- RDI
    lea    rsi, qword ptr [rcx + 8]
    cmp    rax, rdi
    mov    rdx, rbx
    mov    rbx, r13
    jne    .LBB0_3

Notice how many mov instructions are used:

-- 
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