<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 --- - failure to remove redundant global without 'norecurse'"
href="https://llvm.org/bugs/show_bug.cgi?id=25631">25631</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>failure to remove redundant global without 'norecurse'
</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>Core LLVM classes
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>In <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - wrong code at -O1, -O2 and -O3 on x86_64-linux-gnu (in 32-bit mode)"
href="show_bug.cgi?id=25629">bug#25629</a>, we have this testcase:
int printf (const char *, ...);
int a, d;
static char b = 48, c;
int
main ()
{
c = b;
for (; c < 45; c++)
a = a ? d : d < a;
b = 0;
printf ("%d\n", c);
return 0;
}
When built as C++, we can completely delete the global variable 'c'. When built
as C++, we cannot. The difference is that 'main' is implicitly 'norecurse' in
C++.
It should be possible to do the same optimization whether or not 'main' is
marked 'norecurse' -- within the entire program, there are only stores and no
loads to @c.
(Running opt over the output a second time results in @c being removed.)</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>