https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66522
Bug ID: 66522 Summary: handle casts in nr of iterations in try_transform_to_exit_first_loop_alt Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- There's a todo in try_transform_to_exit_first_loop_alt: ... /* There is a number of test-cases for which we don't get an alt_bound here: they're listed here, with the lhs of the last stmt as the nit: libgomp.graphite/force-parallel-1.c: _21 = (signed long) N_6(D); _19 = _21 + -1; _7 = (unsigned long) _19; libgomp.graphite/force-parallel-2.c: _33 = (signed long) N_9(D); _16 = _33 + -1; _37 = (unsigned long) _16; libgomp.graphite/force-parallel-5.c: <bb 6>: # graphite_IV.5_46 = PHI <0(5), graphite_IV.5_47(11)> <bb 7>: _33 = (unsigned long) graphite_IV.5_46; g++.dg/tree-ssa/pr34355.C: _2 = (unsigned int) i_9; _3 = 4 - _2; gcc.dg/pr53849.c: _5 = d.0_11 + -2; _18 = (unsigned int) _5; We will be able to handle some of these cases, if we can determine when it's safe to look past casts. */ ... I'm running into this todo for a trivial fortran test-case gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95: ... ! { dg-additional-options "-O2" } ! { dg-require-effective-target pthread } ! { dg-additional-options "-ftree-parallelize-loops=2" } ! { dg-additional-options "-fdump-tree-parloops" } ! Variable bound, vector addition. subroutine foo(nr) integer, intent(in) :: nr integer, parameter :: n = 1000 integer, dimension (0:n-1) :: a, b, c common a, b, c integer :: ii do ii = 0, nr - 1 c(ii) = a(ii) + b(ii) + 25 end do end subroutine foo ! Three times 'plus 25' ! - one in f._loopfn.0 ! - one in the parallel ! - one in the low iteration count loop ! Crucially, none for a peeled off last iteration following the parallel. ! { dg-final { scan-tree-dump-times "(?n) \\+ 25;" 3 "parloops" } } ... The scan-tree-dump-times currently fails, so try_transform_to_exit_first_loop_alt is failing.