This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR36078, fallout from early loop unrolling
On Tue, 29 Apr 2008, Zdenek Dvorak wrote:
> Hi,
>
> > This patch adds a missing SSA update after early complete loop unrolling.
> > Appearantly this is only needed if unrolling doesn't operate on
> > loop-closed SSA form, but it might also paper over a problem with not
> > doing so.
>
> why does this help? We already call update_ssa in
> try_unroll_loop_completely.
Hm, the difference with the (indeed extra) update_ssa is
--- a/t.f90.056t.cunrolli 2008-04-29 15:36:31.000000000 +0200
+++ b/t.f90.056t.cunrolli 2008-04-29 15:38:35.000000000 +0200
@@ -93,24 +93,6 @@
Merging blocks 11 and 3
Merging blocks 2 and 9
Merging blocks 2 and 11
-
-
-Symbols to be put in SSA form
-
-{ PARM_NOALIAS.43 }
-
-
-SSA names to release after updating the SSA web
-
-PARM_NOALIAS.43_35 PARM_NOALIAS.43_265 PARM_NOALIAS.43_335
-
-Incremental SSA update started at block: 0
-
-Number of blocks in CFG: 5
-Number of blocks to update: 4 ( 80%)
-
-
-
foo (void (*<T2da>) (struct array1_real(kind=8) &, struct
array2_real(kind=8) &) func, real(kind=8)[375] * p, logical(kind=4)[125] *
eval)
{
void * D.1030;
@@ -490,7 +472,7 @@
D.1057_341 = (*D.1052_340)[S.21_333];
D.1058_342 = (integer(kind=8)) D.1057_341;
# A.19_343 = VDEF <A.19_330>
- # PARM_NOALIAS.43_344 = VDEF <PARM_NOALIAS.43_246>
+ # PARM_NOALIAS.43_344 = VDEF <PARM_NOALIAS.43_331>
# SMT.51_345 = VDEF <SMT.51_332>
(*D.1055_339)[S.21_333] = D.1058_342;
S.21_346 = S.21_333 + 1;
as we run CFG cleanup after updating SSA form in
try_unroll_loop_completely, some constants are propagated from PHIs
and the VOPs change during CFG cleanup requiring an SSA update
(cfg-cleanup vs. non-cfg-cleanup variant):
+
+<bb 8>:
+ # SMT.51_321 = PHI <SMT.51_253(2)>
+ # PARM_NOALIAS.43_322 = PHI <PARM_NOALIAS.43_246(2)>
+ # A.19_323 = PHI <A.19_245(2)>
+ # S.21_324 = PHI <0(2)>
+
+<bb 9>:
# VUSE <atmp.18_263>
D.1054_325 = atmp.18.data;
D.1055_326 = (integer(kind=8)[2] *) D.1054_325;
D.1052_327 = (integer(kind=4)[2] *) D.1051_32;
# VUSE <A.16_257>
- D.1057_328 = (*D.1052_327)[0];
+ D.1057_328 = (*D.1052_327)[S.21_324];
D.1058_329 = (integer(kind=8)) D.1057_328;
- # A.19_330 = VDEF <A.19_245>
- # SMT.51_332 = VDEF <SMT.51_253>
- (*D.1055_326)[0] = D.1058_329;
- S.21_333 = 1;
+ # A.19_330 = VDEF <A.19_323>
+ # PARM_NOALIAS.43_331 = VDEF <PARM_NOALIAS.43_322>
+ # SMT.51_332 = VDEF <SMT.51_321>
+ (*D.1055_326)[S.21_324] = D.1058_329;
+ S.21_333 = S.21_324 + 1;
so with CFG cleanup we have
- # A.19_330 = VDEF <A.19_245>
- # SMT.51_332 = VDEF <SMT.51_253>
- (*D.1055_326)[0] = D.1058_329;
while without we have
+ # A.19_330 = VDEF <A.19_323>
+ # PARM_NOALIAS.43_331 = VDEF <PARM_NOALIAS.43_322>
+ # SMT.51_332 = VDEF <SMT.51_321>
+ (*D.1055_326)[S.21_324] = D.1058_329;
so the use of PARM_NOALIAS.43_331 is no longer valid and an SSA
update is required.
This may be a latent general problem of course, which the patch
(bootstrapped and tested ok meanwhile) only papers over.
Richard.