[Bug tree-optimization/25243] New: Jump threading opportunity missed in tree-ssa but caught in jump1
steven at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Dec 3 14:21:00 GMT 2005
static const int e[4] = { 16, 16, 20, 20 };
extern void foo (unsigned long *);
void
baz (unsigned long *r)
{
unsigned long i;
for (i = 0; i < 4; i++)
if (e[i] == 16)
break;
if (i == 4)
{
foo (r);
}
}
We have the following in the .vars tree dump:
;; Function baz (baz)
baz (r)
{
long unsigned int i;
<bb 0>:
i = 0;
<L0>:;
if (MEM[symbol: e, index: (int *) i, step: 4B] == 16) goto <L5>; else goto
<L1>;
<L1>:;
i = i + 1;
if (i != 4) goto <L0>; else goto <L3>;
<L3>:;
if (i == 4) goto <L4>; else goto <L5>;
<L4>:;
foo (r);
<L5>:;
return;
}
The first jump pass on RTL immediately optimizes away the redundant jump.
This kind of jump threading opportunity occurs very often. About half of the
jump threadings on RTL in jump1 that I have looked at so far (several dozen)
are of this form.
I'm seeing this for AMD64 and i686, but I guess it happens everywhere.
--
Summary: Jump threading opportunity missed in tree-ssa but caught
in jump1
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25243
More information about the Gcc-bugs
mailing list