<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=52535">52535</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
static int a = 1, b;
void foo(void);
int main() {
for (unsigned d = 0; d < 19; ++d) {
if ((char)a <= d)
for (; b < 1; b++)
foo();
else
break;
}
a = 128;
}
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:
xorl %eax, %eax
retq
.Lfunc_end0:
clang-trunk -O3 -S -o /dev/stdout case.c
main: # @main
.cfi_startproc
# %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
pushq %rax
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -24
.cfi_offset %rbp, -16
xorl %ebx, %ebx
movl $-128, %ebp
jmp .LBB0_1
.p2align 4, 0x90
.LBB0_4: # in Loop: Header=BB0_1 Depth=1
addl $1, %ebx
cmpl $19, %ebx
je .LBB0_5
.LBB0_1: # =>This Loop Header: Depth=1
# Child Loop BB0_3 Depth 2
cmpb $0, a(%rip)
movl $1, %eax
cmovnel %ebp, %eax
cmpl %ebx, %eax
ja .LBB0_5
# %bb.2: # in Loop: Header=BB0_1 Depth=1
cmpl $0, b(%rip)
jg .LBB0_4
.p2align 4, 0x90
.LBB0_3: # Parent Loop BB0_1 Depth=1
# => This Inner Loop Header: Depth=2
callq foo
movl b(%rip), %eax
leal 1(%rax), %ecx
movl %ecx, b(%rip)
testl %eax, %eax
js .LBB0_3
jmp .LBB0_4
.LBB0_5:
movb $1, a(%rip)
xorl %eax, %eax
addq $8, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %rbp
.cfi_def_cfa_offset 8
retq
.Lfunc_end0:
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>
1ee32055ea1dd4db70d1939cbd4f5105c2dce160)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Started with
<a href="https://github.com/llvm/llvm-project/commit/3af8a11bc66b93dc3f63ce7192647a27189aeefc">https://github.com/llvm/llvm-project/commit/3af8a11bc66b93dc3f63ce7192647a27189aeefc</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>