<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Dead Code Elimination Regression at -O3 (trunk&13.0.0 vs 12.0.1)"
href="https://bugs.llvm.org/show_bug.cgi?id=52346">52346</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Dead Code Elimination Regression at -O3 (trunk&13.0.0 vs 12.0.1)
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>theodort@inf.ethz.ch
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>cat test.c
void foo(void);
char bar(void);
static int b = 1, c;
int main() {
int e = 0;
int f[] = {1, 1, 1};
b = 0;
for (; b; b = bar())
f[1] = e;
for (; c < 1; c++) {
if (!f[c])
foo();
}
}
12.0.1 at -O3 can eliminate the call to foo but neither 13.0.0 nor trunk can:
clang-12 -O3 -S -o /dev/stdout test.c | grep foo
clang-13 -O3 -S -o /dev/stdout test.c | grep foo
callq foo
clang-trunk -O3 -S -o /dev/stdout test.c | grep foo
callq foo
clang-trunk -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
73453e7adecbcc7208ceb70d5e55086ffbd1de3a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
This was introduced by
<a href="https://github.com/llvm/llvm-project/commit/a26f1bf67ec70f72e64101cf483b26466928fc38">https://github.com/llvm/llvm-project/commit/a26f1bf67ec70f72e64101cf483b26466928fc38</a></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>