[LLVMbugs] [Bug 6539] New: x86 asm earlyclobber not respected

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 7 23:52:53 PST 2010


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

           Summary: x86 asm earlyclobber not respected
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Register Allocator
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: astrange at ithinksw.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4422)
 --> (http://llvm.org/bugs/attachment.cgi?id=4422)
unminimized source

Using checker-236 and

> ~/checker-236/bin/clang -O3 -mdynamic-no-pic -m32 -fomit-frame-pointer -S cabac_residual.i

the first inline asm compiled has its first input and output both assigned to
eax:
_decode_cabac_residual_internal:
...
LBB1_6:
...
    ## InlineAsm Start
    movl 4(%edi), %esi            
    movl 0(%edi), %ebx            
    movzbl (%eax)    , %eax   

This is compiled from:
static inline int get_cabac_inline(CABACContext *c, uint8_t *const state) {
    int bit;

    asm volatile (
    "movl 4(%2), %%esi            \n\t"
    "movl 0(%2), %%ebx            \n\t"
    "movzbl (%1)    , %0                                     \n\t"
...
    : "=&a" (bit) : "r" (state), "r" (c) : "%ecx", "%ebx", "%edx", "%esi",
"memory");

bit is an earlyclobber, so it should be assigned eax and nothing else should.

This only seems to happen when inlined, so I was unable to minimize it very
far.
This causes ffmpeg (and therefore anything else including it) to miscompile and
crash on x86-32 in the H.264 decoder.

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