[LLVMbugs] [Bug 11344] New: Use constants in registers to avoid immediate constants in instructions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 8 16:38:23 PST 2011


             Bug #: 11344
           Summary: Use constants in registers to avoid immediate
                    constants in instructions
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: pete.cooper at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In MultiSource/.../oggenc vorbis_encode_ctl the following sequence of
instructions is generated

        testq    %rbx, %rbx
    jne    LBB11_38
    movq    $0, 5568(%rax)
    movq    $0, 5592(%rax)
    movq    $0, 5600(%rax)
    pxor    %xmm0, %xmm0
    xorl    %ecx, %ecx
    xorl    %edx, %edx
    jmp    LBB11_43

I think for the $0 in the moves we should use the knowledge that %rbx must
already be 0 since the condition jumped on nonzero.  We can then use rbi in the
instructions to shorten the encoding.  More generally, we should use any
knowledge we have of constants in registers from previous blocks to avoid
regenerating them in current blocks.

An alternative to using %rbx here would have been to see that any the end of
the block both %ecx and %edx were set to 0.  Had those been 64-bit registers we
could have used either on instead of $0 had we moved the xor sooner

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list