<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"
href="https://bugs.llvm.org/show_bug.cgi?id=51090">51090</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Dead Code Elimination Regression
</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>theodoros.theodoridis@inf.ethz.ch
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>extern void foo(void);
int a;
short b(unsigned short c, int d) {
return d < 0 || c > (600 >> d) ? c : c << d;
}
int main() {
char f;
int g = 300;
while (a) {
f = g;
if (!b(f, 2)) {
foo();
g = 0;
}
}
return 0;
}
commit 1a02aaeaa4f8675490da38ee8cb0d4a6d39815dd introduced a regression
(for Target: x86_64-unknown-linux-gnu).
The generated asm (clang -S -c -O3) for main before that commit was:
main: # @main
.Lmain$local:
.cfi_startproc
# %bb.0:
cmpl $0, .La$local(%rip)
je .LBB1_2
.p2align 4, 0x90
.LBB1_1: # =>This Inner Loop Header: Depth=1
jmp .LBB1_1
.LBB1_2:
xorl %eax, %eax
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc
and after:
main: # @main
.Lmain$local:
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movl .La$local(%rip), %eax
testl %eax, %eax
je .LBB1_5
# %bb.1:
movl $300, %edx # imm = 0x12C
jmp .LBB1_2
.p2align 4, 0x90
.LBB1_4: # in Loop: Header=BB1_2 Depth=1
testl %eax, %eax
je .LBB1_5
.LBB1_2: # =>This Inner Loop Header: Depth=1
movsbl %dl, %ecx
movzwl %cx, %esi
cmpl $151, %esi
setb %cl
addb %cl, %cl
shll %cl, %esi
testw %si, %si
jne .LBB1_4
# %bb.3: # in Loop: Header=BB1_2 Depth=1
callq foo
xorl %edx, %edx
movl .La$local(%rip), %eax
jmp .LBB1_4
.LBB1_5:
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end1:
.size main, .Lfunc_end1-main
.cfi_endproc</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>