------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-20
00:46 -------
Here is another reduced testcase:
subroutine thin6d(max)
parameter(maxindex=64)
common array1(maxindex)
save
do 20 j=1,max
array1(j)=1.0
20 continue
return
end
but note disabling ivopts "fixes" the problem but it is not caused by ivopts
per say this time:
Before out of SSA:
# ivtmp.6_21 = PHI <ivtmp.6_24(1), ivtmp.6_22(3)>;
# ivtmp.3_12 = PHI <0(1), ivtmp.3_20(3)>;
<L7>:;
[thin6d.f : 6] *ivtmp.6_21 = 1.0e+0;
__label_000020:;
ivtmp.3_20 = ivtmp.3_12 + 1;
ivtmp.6_22 = ivtmp.6_21 + 4B;
[thin6d.f : 1] D.493_30 = D.451_4 - 1;
[thin6d.f : 1] D.494_31 = (<unnamed type>) D.493_30;
[thin6d.f : 1] D.495_32 = D.494_31 + 1;
[thin6d.f : 5] if (ivtmp.3_20 == D.495_32) [thin6d.f : 5] goto <L11>; else
goto <L7>;
Note this is looks very normal and like it should work correctly (except for
the ((cast)(a-1))+1 but I
know Zdenek has a patch for that).
But for some reason (have not looked actually) we add an extra BB in out of SSA:
<L7>:;
[thin6d.f : 6] *ivtmp.6 = 1.0e+0;
__label_000020:;
ivtmp.10 = ivtmp.3 + 1;
ivtmp.6 = ivtmp.6 + 4B;
[thin6d.f : 5] if (ivtmp.10 == (<unnamed type>) (D.451 - 1) + 1) [thin6d.f :
5] goto <L11>; else goto
<L13>;
<L13>:;
ivtmp.3 = ivtmp.10;
goto <bb 2> (<L7>);
Looks like we are not coalescing the following PHI:
# ivtmp.3_12 = PHI <0(1), ivtmp.3_20(3)>;
But why not.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19038