<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 vs 13.0.0)"
href="https://bugs.llvm.org/show_bug.cgi?id=52543">52543</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Dead Code Elimination Regression at -O3 (trunk vs 13.0.0)
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>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 case.c
void foo(void);
static unsigned char f(int *x) { return *x; }
static int b = -1;
int main() {
unsigned char c = f(&b);
unsigned char r = c >= 2 ? 1 : 1 << c;
if (!r)
foo();
b = 0;
}
trunk cannot eliminate the call to foo but 13.0.0 can:
clang-13.0.0 -O3 -S -o /dev/stdout case.c
main: # @main
.cfi_startproc
# %bb.0:
movb $1, b(%rip)
xorl %eax, %eax
retq
.Lfunc_end0:
clang-trunk -O3 -S -o /dev/stdout case.c
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movb b(%rip), %al
xorb $1, %al
movzbl %al, %ecx
movl %ecx, %edx
andl $1, %edx
negl %edx
andb $1, %cl
negb %cl
movl $1, %eax
# kill: def $cl killed $cl killed $ecx
shll %cl, %eax
testb $-2, %dl
jne .LBB0_3
# %bb.1:
testb %al, %al
jne .LBB0_3
# %bb.2:
callq foo
.LBB0_3:
movb $1, b(%rip)
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end0:
clang-trunk -v
clang version 14.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
693b02023e997f3733b63ae316891509894d344a)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Started with
<a href="https://github.com/llvm/llvm-project/commit/acabad9ff6bf13e00305d9d8621ee8eafc1f8b08">https://github.com/llvm/llvm-project/commit/acabad9ff6bf13e00305d9d8621ee8eafc1f8b08</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>