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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to