<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - [globalsmodref-aa] Atomics not considered to access memory."
href="https://llvm.org/bugs/show_bug.cgi?id=23345">23345</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[globalsmodref-aa] Atomics not considered to access memory.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Global Analyses
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chisophugis@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The loop "// Scan the function bodies for explicit loads or stores." in
<a href="http://llvm.org/klaus/llvm/blob/master/lib/Analysis/IPA/GlobalsModRef.cpp#L-438">http://llvm.org/klaus/llvm/blob/master/lib/Analysis/IPA/GlobalsModRef.cpp#L-438</a>
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 %.
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>