[Bug tree-optimization/42108] [4.4/4.5 Regression] Vectorizer cannot deal with PAREN_EXPR gracefully, 50% performance regression
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Nov 20 14:14:00 GMT 2009
------- Comment #12 from rguenth at gcc dot gnu dot org 2009-11-20 14:13 -------
The loop is not unrolled because the frontend presents us with very funny
obfuscated code:
do k=i,nnd,n
temp=temp+(x(k)-x(k+jmini))**2
end do
gets translated to
{
character(kind=4) countm1.6;
integer(kind=4) D.1551;
integer(kind=4) D.1550;
integer(kind=4) D.1549;
D.1549 = i;
D.1550 = *nnd;
D.1551 = *n;
k = D.1549;
if (D.1551 > 0)
{
if (D.1550 < D.1549) goto L.6;, countm1.6 = (character(kind=4)) (D.1550 -
D.1549) / (character(kind=4)) D.1551;;
}
else
{
if (D.1550 > D.1549) goto L.6;, countm1.6 = (character(kind=4)) (D.1549 -
D.1550) / (character(kind=4)) -D.1551;;
}
while (1)
{
{
real(kind=8) D.1556;
real(kind=8) D.1555;
D.1555 = (((*x)[(integer(kind=8)) k + -1] - (*x)[(integer(kind=8)) (k
+ jmini) + -1]));
D.1556 = D.1555 * D.1555;
temp = temp + D.1556;
}
L.5:;
k = k + D.1551;
if (countm1.6 == 0) goto L.6;
countm1.6 = countm1.6 + 4294967295;
}
L.6:;
}
WTF!?
The funny conditional initialization of countm1.6 makes the analysis of
the number of iterations of this loop impossible (not to mention the
conversions to character(kind=4)).
Why does the frontend do induction variable "optimization" at all and
not simply generate a loop with a non-unit counting IV?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42108
More information about the Gcc-bugs
mailing list