On Thu, Dec 08, 2011 at 08:48:31PM +0100, Thomas Koenig wrote:
> this is what I hope is the final round of the OMP front-end optimization
> patch.  This one ignores outer workshares when doing function
> elimination within omp do and similar blocks.

Sorry, stopped reading the patch details once noticing you are
reimplementing vec.h.  Reading it again, isn't it overkill to keep the
vector?  All you need is a bool and a way to restore its previous state.

static bool in_omp_workshare;

and in gfc_code_walker:

  bool save_in_omp_workshare = in_omp_workshare;
  switch (...)
    case EXEC_OMP_WORKSHARE:
    case EXEC_OMP_PARALLEL_WORKSHARE:
      in_omp_workshare = true;
      ...
    case EXEC_OMP_PARALLEL:
    case EXEC_OMP_PARALLEL_DO:
    case EXEC_OMP_PARALLEL_SECTIONS:
      in_omp_workshare = false;
      ...
  ...
  in_omp_workshare = save_in_omp_workshare;

That said, it would be nice if the other vector-ish array got vec.h-ized.

> ! { dg-do compile }
> ! { dg-options "-ffrontend-optimize -fdump-tree-original" }
> ! PR 50690 - this used to ICE because workshare could not handle
> ! BLOCKs.
> ! To test for correct execution, run this program (but don't forget
> ! to unset the stack limit).
> program foo
>   implicit none
>   integer, parameter :: n = 100000000

Why can't you use a reasonable size, like 100000?

        Jakub

Reply via email to