[Bug middle-end/50971] New: Only one loop detected when there should be two
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 3 00:16:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50971
Bug #: 50971
Summary: Only one loop detected when there should be two
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pinskia@gcc.gnu.org
Take:
typedef struct basket
{
int *a;
int cost;
int abs_cost;
} BASKET;
BASKET *perm[50 +300 +1];
int f(int a, int *b, int cut)
{
do {
while (perm[a]->abs_cost > cut)
a++;
a++;
} while (b[a]);
return a;
}
--- CUT ---
Currently cfgloop finds only one loop as both loops start at the same basic
block.
This causes Loop Copy header not do its job and copy the while's loop's header.
Note the code could be rewritten like to get the same effect:
int f1(int a, int *b, int cut)
{
do {
if (perm[a]->abs_cost > cut)
{
a++;
continue;
}
a++;
} while (b[a]);
return a;
}
--- CUT ---
Note fixing this might help MCF in SPEC 2006.
More information about the Gcc-bugs
mailing list