This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/88271] Omit test instruction after add
- From: "bugzilla at poradnik-webmastera dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Dec 2018 21:11:09 +0000
- Subject: [Bug target/88271] Omit test instruction after add
- Auto-submitted: auto-generated
- References: <bug-88271-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88271
--- Comment #10 from Daniel Fruzynski <bugzilla@poradnik-webmastera.com> ---
Here is possible code transformation to equivalent form, where this
optimization can be simply applied. This change also has a bit surprising side
effect, second nested while loop is unrolled.
[code]
void test2()
{
int level = 0;
int val = 1;
while (1)
{
while(1)
{
val = data[level] << 1;
++level;
if (val)
continue;
else
break;
}
while(1)
{
--level;
val = data[level];
if (!val)
continue;
else
break;
}
}
}
[/code]