diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2009-01-24 00:59:51 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-01-24 00:59:51 +0000 |
commit | b840fb02f5704b62494b84cfb4298b139da44a17 (patch) | |
tree | 1a379d5668d1da83b452efb96fbb212b8a824b8a | |
parent | 77f9581b890f0d19c5d6c6bddb4aef72b5e02bb9 (diff) | |
download | gcc-b840fb02f5704b62494b84cfb4298b139da44a17.zip gcc-b840fb02f5704b62494b84cfb4298b139da44a17.tar.gz gcc-b840fb02f5704b62494b84cfb4298b139da44a17.tar.bz2 |
re PR tree-optimization/38953 ([graphite] loop closed SSA not maintained by graphite code generation)
2009-01-24 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/38953
* graphite.c (graphite_verify): Add a call to verify_loop_closed_ssa.
(scop_adjust_phis_for_liveouts): Initialize false_i to zero.
(gloog): Split the exit of the scop when the scop exit is a loop exit.
(graphite_transform_loops): Only call cleanup_tree_cfg if gloog
changed the CFG.
* gfortran.dg/graphite/pr38953.f90: New.
From-SVN: r143599
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/graphite.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/graphite/pr38953.f90 | 115 |
4 files changed, 153 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad886c8..0b172fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-01-24 Sebastian Pop <sebastian.pop@amd.com> + + PR tree-optimization/38953 + * graphite.c (graphite_verify): Add a call to verify_loop_closed_ssa. + (scop_adjust_phis_for_liveouts): Initialize false_i to zero. + (gloog): Split the exit of the scop when the scop exit is a loop exit. + (graphite_transform_loops): Only call cleanup_tree_cfg if gloog + changed the CFG. + 2009-01-24 Paul Brook <paul@codesourcery.com> * config/arm/neon.md (neon_type): Move to arm.md. diff --git a/gcc/graphite.c b/gcc/graphite.c index f169f72..3cb24b8 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -2178,6 +2178,7 @@ graphite_verify (void) verify_dominators (CDI_DOMINATORS); verify_dominators (CDI_POST_DOMINATORS); verify_ssa (false); + verify_loop_closed_ssa (); #endif } @@ -5229,7 +5230,8 @@ scop_adjust_phis_for_liveouts (scop_p scop, basic_block bb, edge false_e, for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) { - unsigned i, false_i; + unsigned i; + unsigned false_i = 0; gimple phi = gsi_stmt (si); if (!is_gimple_reg (PHI_RESULT (phi))) @@ -5376,9 +5378,9 @@ compute_cloog_iv_types (struct clast_stmt *stmt) } /* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for - the given SCOP. */ + the given SCOP. Return true if code generation succeeded. */ -static void +static bool gloog (scop_p scop, struct clast_stmt *stmt) { edge new_scop_exit_edge = NULL; @@ -5387,6 +5389,19 @@ gloog (scop_p scop, struct clast_stmt *stmt) loop_p context_loop; ifsese if_region = NULL; + /* To maintain the loop closed SSA form, we have to keep the phi + nodes after the last loop in the scop. */ + if (loop_depth (SESE_EXIT (SCOP_REGION (scop))->dest->loop_father) + != loop_depth (SESE_EXIT (SCOP_REGION (scop))->src->loop_father)) + { + basic_block bb = SESE_EXIT (SCOP_REGION (scop))->dest; + SESE_EXIT (SCOP_REGION (scop)) = split_block_after_labels (bb); + bitmap_set_bit (SCOP_BBS_B (scop), bb->index); + pointer_set_insert (SESE_REGION_BBS (SCOP_REGION (scop)), bb); + } + + recompute_all_dominators (); + graphite_verify (); if_region = move_sese_in_condition (SCOP_REGION (scop)); sese_build_livein_liveouts (SCOP_REGION (scop)); scop_insert_phis_for_liveouts (SCOP_REGION (scop), @@ -5412,6 +5427,7 @@ gloog (scop_p scop, struct clast_stmt *stmt) recompute_all_dominators (); graphite_verify (); + return true; } /* Returns the number of data references in SCOP. */ @@ -6040,6 +6056,7 @@ graphite_transform_loops (void) { int i; scop_p scop; + bool transform_done = false; if (number_of_loops () <= 1) return; @@ -6098,7 +6115,7 @@ graphite_transform_loops (void) } if (graphite_apply_transformations (scop)) - gloog (scop, find_transform (scop)); + transform_done = gloog (scop, find_transform (scop)); #ifdef ENABLE_CHECKING else { @@ -6109,7 +6126,9 @@ graphite_transform_loops (void) } /* Cleanup. */ - cleanup_tree_cfg (); + if (transform_done) + cleanup_tree_cfg (); + free_scops (current_scops); cloog_finalize (); free_original_copy_tables (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee4afc6..1ae8375 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-24 Sebastian Pop <sebastian.pop@amd.com> + + PR tree-optimization/38953 + * gfortran.dg/graphite/pr38953.f90: New. + 2009-01-24 Paul Brook <paul@codesourcery.com> * gcc.target/arm/neon-cond-1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/graphite/pr38953.f90 b/gcc/testsuite/gfortran.dg/graphite/pr38953.f90 new file mode 100644 index 0000000..245db0d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/pr38953.f90 @@ -0,0 +1,115 @@ +! { dg-options "-O3 -floop-block -fgraphite-identity" } + + MODULE MAIN1 + INTEGER , PARAMETER :: IFMAX = 40 , IKN = 85 , ISTRG = 132 , & + & IERRN = 170 , ILEN_FLD = 80 + CHARACTER PATH*2 , PPATH*2 , KEYWRD*8 , PKEYWD*8 , KEYWD*8 , & + & KTYPE*5 , RUNST*1 + DIMENSION FIELD(IFMAX) , KEYWD(IKN) , RUNST(ISTRG) + LOGICAL :: DFAULT , CONC , DEPOS , DDEP , WDEP , RURAL , URBAN , & + & GRDRIS , NOSTD , NOBID , CLMPRO , MSGPRO , PERIOD , & + & OLM=.FALSE. + INTEGER :: NSRC , NREC , NGRP , NQF, & + & NARC , NOLM + CHARACTER NETID*8 , NETIDT*8 , PNETID*8 , NTID*8 , NTTYP*8 , & + & RECTYP*2 , PXSOID*8 , PESOID*8 , ARCID*8 + ALLOCATABLE ::NETID(:) , RECTYP(:) , NTID(:) , NTTYP(:) , ARCID(:) + DATA (KEYWD(I),I=1,IKN)/'STARTING' , 'FINISHED' , 'TITLEONE' , & + & 'TITLETWO' , 'MODELOPT' , 'AVERTIME' , 'POLLUTID' , & + & 'HALFLIFE' , 'DCAYCOEF' , 'DEBUGOPT' , 'ELEVUNIT' , & + & 'FLAGPOLE' , 'RUNORNOT' , 'EVENTFIL' , 'SAVEFILE' , & + & 'INITFILE' , 'MULTYEAR' , 'ERRORFIL' , 'GASDEPDF' , & + & 'GDSEASON' , 'GASDEPVD' , 'GDLANUSE' , 'EVENTFIL' , & + & 'URBANOPT' , 'METHOD_2' , 'LOCATION' , 'SRCPARAM' , & + & 'BUILDHGT' , 'BUILDWID' , 'BUILDLEN' , 'XBADJ ' , & + & 'YBADJ ' , 'EMISFACT' , 'EMISUNIT' , 'PARTDIAM' , & + & 'MASSFRAX' , 'PARTDENS' , ' ' , ' ' , & + & ' ' , 'CONCUNIT' , 'DEPOUNIT' , 'HOUREMIS' , & + & 'GASDEPOS' , 'URBANSRC' , 'EVENTPER' , 'EVENTLOC' , & + & 'SRCGROUP' , 'GRIDCART' , 'GRIDPOLR' , 'DISCCART' , & + & 'DISCPOLR' , 'SURFFILE' , 'PROFFILE' , 'PROFBASE' , & + & ' ' , 'SURFDATA' , 'UAIRDATA' , 'SITEDATA' , & + & 'STARTEND' , 'DAYRANGE' , 'WDROTATE' , 'DTHETADZ' , & + & 'WINDCATS' , 'RECTABLE' , 'MAXTABLE' , 'DAYTABLE' , & + & 'MAXIFILE' , 'POSTFILE' , 'PLOTFILE' , 'TOXXFILE' , & + & 'EVENTOUT' , 'INCLUDED' , 'SCIMBYHR' , 'SEASONHR' , & + & 'AREAVERT' , 'PARTSIZE' , 'RANKFILE' , 'EVALCART' , & + & 'EVALFILE' , 'NO2EQUIL' , 'OZONEVAL' , 'OZONEFIL' , & + & 'NO2RATIO' , 'OLMGROUP'/ + DIMENSION RESTAB(9,6,5) , STAB(9) + DATA (((RESTAB(I,J,K),I=1,9),J=1,6),K=1,5)/1.E07 , 60. , 120. , & + & 100. , 200. , 150. , 1.E07 , 1.E07 , 80. , 1.E07 , 2000. , & + & 2000. , 2000. , 2000. , 2000. , 1.E07 , 1.E07 , 2500. , & + & 1.E07 , 1000. , 1000. , 1000. , 2000. , 2000. , 1.E07 , & + & 1.E07 , 1000. , 100. , 200. , 100. , 2000. , 100. , 1500. , & + & 0. , 0. , 300. , 400. , 150. , 350. , 300. , 500. , 450. , & + & 0. , 1000. , 0. , 300. , 150. , 200. , 200. , 300. , 300. , & + & 2000. , 400. , 1000. , 1.E07 , 1.E07 , 1.E07 , 350. , & + & 1.E07 , 700. , 1.E07 , 1.E07 , 1.E07 , 1.E07 , 6500. , & + & 6500. , 3000. , 2000. , 2000. , 1.E07 , 1.E07 , 6500. , & + & 1.E07 , 400. , 300. , 500. , 600. , 1000. , 1.E07 , 1.E07 , & + & 300. , 100. , 150. , 100. , 1700. , 100. , 1200. , 0. , 0. ,& + & 200. , 400. , 200. , 350. , 300. , 500. , 450. , 0. , & + & 1000. , 0. , 300. , 150. , 200. , 200. , 300. , 300. , & + & 2000. , 400. , 800. , 1.E07 , 1.E07 , 1.E07 , 500. , 1.E07 ,& + & 1000. , 1.E07 , 1.E07 , 1.E07 , 1.E07 , 1.E07 , 9000. , & + & 6000. , 2000. , 2000. , 1.E07 , 1.E07 , 9000. , 1.E07 , & + & 1.E07 , 400. , 600. , 800. , 1600. , 1.E07 , 1.E07 , 800. , & + & 100. , 0. , 100. , 1500. , 100. , 1000. , 0. , 0. , 100. , & + & 400. , 150. , 350. , 300. , 500. , 450. , 0. , 0. , 1000. , & + & 300. , 150. , 200. , 200. , 300. , 300. , 2000. , 400. , & + & 1000. , 1.E07 , 1.E07 , 1.E07 , 800. , 1.E07 , 1600. , & + & 1.E07 , 1.E07 , 1.E07 , 1.E07 , 1.E07 , 1.E07 , 400. , & + & 1.E07 , 800. , 1.E07 , 1.E07 , 9000. , 1.E07 , 2000. , & + & 1000. , 600. , 2000. , 1200. , 1.E07 , 1.E07 , 800. , 100. ,& + & 0. , 10. , 1500. , 100. , 1000. , 0. , 0. , 50. , 100. , & + & 100. , 100. , 100. , 200. , 200. , 0. , 1000. , 100. , & + & 600. , 3500. , 3500. , 3500. , 500. , 500. , 2000. , 400. , & + & 3500. , 1.E07 , 100. , 120. , 100. , 200. , 150. , 1.E07 , & + & 1.E07 , 80. , 1.E07 , 2000. , 2000. , 1500. , 2000. , & + & 2000. , 1.E07 , 1.E07 , 2000. , 1.E07 , 1000. , 250. , & + & 350. , 500. , 700. , 1.E07 , 1.E07 , 300. , 100. , 50. , & + & 80. , 1500. , 100. , 1000. , 0. , 0. , 200. , 500. , 150. , & + & 350. , 300. , 500. , 450. , 0. , 1000. , 0. , 300. , 150. , & + & 200. , 200. , 300. , 300. , 2000. , 400. , 1000./ + END + SUBROUTINE SHAVE + USE MAIN1 + IF ( PERIOD ) THEN + 9020 FORMAT ('(''*'',8X,''X'',13X,''Y'',4X,',I1, & + &'(2X,3A4),4X,''ZELEV'', 4X,''ZHILL'',4X,''ZFLAG'',4X,''AVE'',5X,& + &_______ ________ ________'')') + ENDIF + DO IGRP = 1 , NUMGRP + IF ( IANPST(IGRP).EQ.1 ) THEN + IF ( IANFRM(IGRP).EQ.0 ) THEN + DO IREC = 1 , NUMREC + ENDDO + ENDIF + DO IREC = 1 , NUMREC + IF ( RECTYP(IREC).EQ.'DC' ) THEN + WRITE (IOUNIT,9082) SRCID(ISRF) , SRCTYP(ISRF) , & + & AXS(ISRF) , AYS(ISRF) , AZS(ISRF) & + & , (J,AXR(IREC+J-1),AYR(IREC+J-1), & + & HCLMSG(IREC+J-1,IHNUM,IGRP,IAVE, & + & ITYP),J=1,36) + 9082 FORMAT (' BOUNDARY RECEPTOR NETWORK OF SOURCE ID: ', & + & 18(2(1X,I4,3X,F10.2,', ',F10.2,',',F13.5,A1, & + & '(',I8.8,')',7X),/),/) + ENDIF + ENDDO + ENDIF + ENDDO + END + USE MAIN1 + IF ( ICOUNT.NE.0 .AND. JCOUNT.NE.0 ) THEN + DO J = 1 , JCOUNT + DO I = 1 , ICOUNT + IF ( ISET.GT.NREC ) THEN + GOTO 999 + ENDIF + ENDDO + ENDDO + ENDIF + 999 CONTINUE + END |