[LLVMbugs] [Bug 20841] New: LLVM fails to use flags from atomic instructions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 3 16:34:06 PDT 2014


            Bug ID: 20841
           Summary: LLVM fails to use flags from atomic instructions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


define zeroext i1 @f(i32* %x) {
  %0 = atomicrmw add i32* %x, i32 1 seq_cst
  %cmp = icmp ne i32 %0, 0
  ret i1 %cmp

this gets CodeGen'd as:
        movl    $1, %eax
        xaddl   %eax, (%rdi)
        testl   %eax, %eax
        setne    %al

Note that the ZF flag was already set from the xadd instruction, the test
instruction is redundant.

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/20140903/98216800/attachment.html>

More information about the llvm-bugs mailing list