This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug in loop invariant motion with trivial test case
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: rakdver at atrey dot karlin dot mff dot cuni dot cz
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 12 Aug 04 06:18:14 EDT
- Subject: Bug in loop invariant motion with trivial test case
This is based on ACATS test ca11012.
Consider:
struct foo {int a; int b;};
extern struct foo sub2 (struct foo, struct foo);
struct foo
sub1 (struct foo a)
{
struct foo result = {0, 0};
int i;
for (i = 0; i < 3; i++)
result = sub2 (result, a);
return result;
}
Look at the .vars file and notice that each call to sub2 is passed the
same operands, not the one obtained by calling the function the
previous time:
sub1 (a)
{
struct foo lsm_tmp.2;
struct foo lsm_tmp.1;
int i;
struct foo result;
struct foo T.0;
<bb 0>:
result.a = 0;
result.b = 0;
lsm_tmp.1 = result;
i = 0;
<L0>:;
lsm_tmp.2 = sub2 (result, a);
i = i + 1;
if (i <= 2) goto <L0>; else goto <L7>;
<L7>:;
result = lsm_tmp.1;
T.0 = result;
return T.0;
}