[LLVMbugs] [Bug 23345] New: [globalsmodref-aa] Atomics not considered to access memory.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 24 20:35:40 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23345

            Bug ID: 23345
           Summary: [globalsmodref-aa] Atomics not considered to access
                    memory.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: chisophugis at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The loop "// Scan the function bodies for explicit loads or stores." in
http://llvm.org/klaus/llvm/blob/master/lib/Analysis/IPA/GlobalsModRef.cpp#L-438
appears to ignore atomic operations (e.g. cmpxchg, atomicrmw).

Patch will be on llvm-commits shortly.

This bug has probably been latent since those instructions were introduced. A
quick blame shows the loop was last touched in 2012.

I found this because the "compare and swap" was being hoisted out of a standard
"compare and swap" loop with -fno-inline:

test case:

opt -S <test2.ll -globalsmodref-aa -licm

test2.ll:

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"

define i32 @_Z1fPx(i64* %p) {
  br label %1

; <label>:1                                       ; preds = %1, %0
  %2 = call i64 @_ZL16compareAndSwap64Pxxx(i64* %p)
  %3 = icmp eq i64 %2, 0
  br i1 %3, label %1, label %4

; <label>:4                                       ; preds = %1
  ret i32 3
}

define internal i64 @_ZL16compareAndSwap64Pxxx(i64* %ptr) nounwind {
  %1 = cmpxchg i64* %ptr, i64 0, i64 -1 monotonic monotonic
  %2 = extractvalue { i64, i1 } %1, 1
  %3 = extractvalue { i64, i1 } %1, 0
  %. = select i1 %2, i64 0, i64 %3
  ret i64 %.
}

-- 
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/20150425/579a3863/attachment.html>


More information about the llvm-bugs mailing list