[LLVMbugs] [Bug 23202] New: Registers are moved around in do{}while(); loop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 11 03:14:50 PDT 2015


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: unassignedbugs at nondot.org
          Reporter: www.kostantinaras at yahoo.gr
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150411/2f3cad56/attachment.html>


More information about the llvm-bugs mailing list