<html>
<head>
<base href="http://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 --- - CmpXchg with optimization off inserts lock-releasing spill"
href="http://llvm.org/bugs/show_bug.cgi?id=22273">22273</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>CmpXchg with optimization off inserts lock-releasing spill
</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>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: AArch64
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>proxytag@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>Created <span class=""><a href="attachment.cgi?id=13713" name="attach_13713" title="Source code">attachment 13713</a> <a href="attachment.cgi?id=13713&action=edit" title="Source code">[details]</a></span>
Source code
When compiling the following with -O0
; ModuleID = 'testios64'
target triple = "arm64-apple-ios"
declare void @X(i64)
define linkonce void @Foo() {
entry:
%Target = alloca i64
%NewValue = alloca i64
%Comparand = alloca i64
%0 = load i64* %NewValue
%1 = load i64* %Comparand
%2 = cmpxchg i64* %Target, i64 %1, i64 %0 seq_cst seq_cst
%3 = extractvalue { i64, i1 } %2, 0
call void @X(i64 %3)
ret void
}
The CmpXChg code generated is:
LBB0_1: ; %cmpxchg.start
; =>This Inner Loop Header: Depth=1
sub x8, x29, #8 ; =8
ldaxr x8, [x8]
ldr x9, [sp, #8] ; 8-byte Folded Reload
cmp x8, x9
str x8, [sp] ; 8-byte Folded Spill <--- LOCK RELEASED
b.eq LBB0_2
b LBB0_3
LBB0_2: ; %cmpxchg.trystore
; in Loop: Header=BB0_1 Depth=1
sub x8, x29, #8 ; =8
ldr x10, [sp, #16] ; 8-byte Folded Reload
stlxr w9, x10, [x8]
cmp w9, #0 ; =0
b.eq LBB0_3
b LBB0_1
LBB0_3: ; %cmpxchg.end
ldr x0, [sp] ; 8-byte Folded Reload
The spill instruction (str x8, [sp]) releases the exclusive lock.</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>