https://bugs.llvm.org/show_bug.cgi?id=34911
Bug ID: 34911
Summary: Redundant comparisons are not eliminated
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: jmuizel...@mozilla.com
CC: llvm-bugs@lists.llvm.org
#include <stdlib.h>
int f(int x) {
if (x < 4)
exit(1);
if (x < 8)
exit(1);
if (x < 12)
exit(1);
if (x < 16)
exit(1);
return x + 5;
}
compiles to:
f(int): # @f(int)
pushq %rax
cmpl $3, %edi
jle .LBB0_5
cmpl $7, %edi
jle .LBB0_5
cmpl $11, %edi
jle .LBB0_5
cmpl $15, %edi
jle .LBB0_5
addl $5, %edi
movl %edi, %eax
popq %rcx
retq
.LBB0_5:
movl $1, %edi
callq exit
compared to gcc's
f(int):
cmpl $15, %edi
jle .L7
leal 5(%rdi), %eax
ret
.L7:
subq $8, %rsp
movl $1, %edi
call exit
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs