Not pulling out obvious non-aliasing global from the loop
Andrew Pinski
pinskia@physics.uc.edu
Thu Aug 26 03:41:00 GMT 2004
While working on a loop pass, I noticed that we were not pulling out
the load
from a global variable from a loop where it obviously cannot alias
anything in
the loop. This seems like it would hurt the vectorizer also.
This example comes from bzip2:
unsigned short *q;
#define NOSB 10
void h1(int last)
{
int i;
for (i=0;i<last+NOSB;i++)
q[i] = 0;
}
Tree after lim:
h1 (last)
{
int i;
int T.16;
short unsigned int * T.15;
short unsigned int * q.14;
short unsigned int * T.13;
unsigned int T.12;
unsigned int i.11;
<bb 0>:
T.16_16 = last_3 + 10;
if (T.16_16 > 0) goto <L4>; else goto <L5>;
<L5>:;
goto <bb 2> (<L2>);
<L4>:;
# i_18 = PHI <0(3), i_11(6)>;
<L0>:;
i.11_5 = (unsigned int)i_18;
T.12_6 = i.11_5 * 2;
T.13_7 = (short unsigned int *)T.12_6;
q.14_9 = q; <--- why is this here and not above the loop
T.15_10 = T.13_7 + q.14_9;
*T.15_10 = 0;
i_11 = i_18 + 1;
if (i_11 < T.16_16) goto <L7>; else goto <L6>;
<L7>:;
goto <bb 1> (<L0>);
<L6>:;
<L2>:;
return;
}
More information about the Gcc
mailing list