[LLVMbugs] [Bug 20376] New: may fail to recognize potential EFLAGS clobbers for compare-exchange operations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 20 19:47:32 PDT 2014


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

            Bug ID: 20376
           Summary: may fail to recognize potential EFLAGS clobbers for
                    compare-exchange operations
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: peter at pcc.me.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Given the following IR:

declare void @g()
declare void @h()
declare void @i()

define void @cx(i64* %foo, i64 %bar, i64 %baz) {
  %cx = cmpxchg i64* %foo, i64 %bar, i64 %baz seq_cst seq_cst
  %p = extractvalue { i64, i1 } %cx, 1
  call void @g()
  br i1 %p, label %t, label %f

t:
  call void @h()
  ret void

f:
  call void @i()
  ret void
}

we currently generate the following x86 code for the entry block of @cx:

cx:                                     # @cx
        .cfi_startproc
# BB#0:
        pushq   %rax
.Ltmp0:
        .cfi_def_cfa_offset 16
        movq    %rsi, %rax
        lock
        cmpxchgq        %rdx, (%rdi)
        callq   g
        jne     .LBB0_2

This is clearly wrong, as the external call may clobber EFLAGS.

-- 
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/20140721/ef018812/attachment.html>


More information about the llvm-bugs mailing list