<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 --- - [EarlyCSE, Missed Opt] "unordered" loads and stores can be removed"
href="http://llvm.org/bugs/show_bug.cgi?id=20807">20807</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[EarlyCSE, Missed Opt] "unordered" loads and stores can be removed
</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>Linux
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>listmail@philipreames.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=12958" name="attach_12958" title="Failing test case for EarlyCSE">attachment 12958</a> <a href="attachment.cgi?id=12958&action=edit" title="Failing test case for EarlyCSE">[details]</a></span>
Failing test case for EarlyCSE
In EarlyCSE, we currently bail on any load or store which is not isSimple.
This condition includes both volatiles and atomics which is slightly more
conservative than we need to be. If a load or store is non-volatile and is
atomic "unordered", there is no additional visibility or ordering requirements
impossed by the memory model. We should be able to remove these loads and
stores, provided that the value we're forwarding from/removing in favor of are
also "unordered".
The only dangerous transformations would be to a) use a normal load value in
place of an atomic load (the other direction is fine) or b) remove an atomic
store based on a following normal store.
Here's one example case (also attached):
@y = common global i32 0, align 4
define i32 @test1() nounwind uwtable ssp {
entry:
store atomic i32 0, i32* @y unordered, align 4
; we can remove this load and forward the store value
%v = load atomic i32* @y unordered, align 4
ret i32 %v
}</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>