[llvm-bugs] [Bug 52289] New: Dead Code Elimination Regression at -O3 (trunk vs 13.0.0)
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 25 01:28:19 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52289
Bug ID: 52289
Summary: Dead Code Elimination Regression at -O3 (trunk vs
13.0.0)
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: theodort at inf.ethz.ch
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
cat test.c
void foo(void);
static int b;
static char a(char h, int i) { return h > i ? h : h << i; }
static long d(long h) { return h; }
int main() {
char e = 0;
short g = 0;
b++;
e = a(b & 8, 7);
g = d(e) * 20681;
if (!(g ^ 1))
foo();
a(0, 0);
}
13.0.0 at -O3 can eliminate the call to foo but trunk cannot:
clang-13 -O3 -S -o /dev/stdout test.c
...
main: # @main
.cfi_startproc
# %bb.0:
addl $1, b(%rip)
xorl %eax, %eax
retq
.Lfunc_end0
clang-trunk -O3 -S -o /dev/stdout test.c
...
main: # @main
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movl b(%rip), %eax
addl $1, %eax
movl %eax, b(%rip)
xorl %edx, %edx
andb $8, %al
movl $7, %ecx
cmovnel %edx, %ecx
# kill: def $cl killed $cl killed $ecx
shlb %cl, %al
movsbl %al, %eax
imull $1355350016, %eax, %eax # imm = 0x50C90000
cmpl $65536, %eax # imm = 0x10000
jne .LBB0_2
# %bb.1:
callq foo
.LBB0_2:
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end0
clang-trunk -v
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
3729a5abf41d992535508e55c5d975f98c54dba0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
This was introduced by
https://github.com/llvm/llvm-project/commit/1f3e35b6d165715ec7bf7ba80d5b982719c7752a
--
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/20211025/d9cef574/attachment.html>
More information about the llvm-bugs
mailing list