public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67998] New: redundant test for 0 when also checking inequality
@ 2015-10-16 21:31 rv at rasmusvillemoes dot dk
2021-06-03 4:14 ` [Bug tree-optimization/67998] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: rv at rasmusvillemoes dot dk @ 2015-10-16 21:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67998
Bug ID: 67998
Summary: redundant test for 0 when also checking inequality
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rv at rasmusvillemoes dot dk
Target Milestone: ---
int f(unsigned a, unsigned b)
{
if (!a || b >= a)
return 5;
return 2;
}
compiles to
f(unsigned int, unsigned int):
testl %edi, %edi
je .L3
cmpl %esi, %edi
jbe .L3
movl $2, %eax
ret
.L3:
movl $5, %eax
ret
The first test is redundant, since if a is zero, the inequality is guaranteed
to hold.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-03 4:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 21:31 [Bug tree-optimization/67998] New: redundant test for 0 when also checking inequality rv at rasmusvillemoes dot dk
2021-06-03 4:14 ` [Bug tree-optimization/67998] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).