[llvm-bugs] [Bug 51090] New: Dead Code Elimination Regression
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 14 08:29:42 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51090
Bug ID: 51090
Summary: Dead Code Elimination Regression
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: theodoros.theodoridis at inf.ethz.ch
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210714/c2b567c9/attachment.html>
More information about the llvm-bugs
mailing list