https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104757

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:431414b5d934866af3f6415a56c35bb57b928fef

commit r12-7459-g431414b5d934866af3f6415a56c35bb57b928fef
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Mar 3 09:13:32 2022 +0100

    openmp: Disable SSA form during gimplification on OMP_SIMD clauses and body
[PR104757]

    When offloading to nvptx is enabled, scan_omp_simd duplicates the simd
    region including its clauses and body using inliner's
    copy_gimple_seq_and_replace_locals.  That works nicely for decls, remaps
    only those that are seen in the nested bind expr vars (i.e. local
variables)
    and doesn't remap other vars.  But for SSA_NAMEs it remaps them always,
doesn't
    know if their def stmt is outside of the simd (then it better shouldn't be
remapped)
    or inside of it (then it should) and without cfg/dominators that is pretty
hard
    to figure out (well, we could walk the region twice, once note SSA_NAMEs
defined
    by each stmt seen there and once do the remapping of only those visited
SSA_NAMEs).

    This patch uses a simpler way, disables temporarily into_ssa for the
clauses and
    body of each simd region; we already disable into_ssa e.g. in
parallel/target/task
    etc. regions through push_gimplify_context () but for simd we don't push
    any gimplification context and appart from into_ssa I think we don't need
it.

    2022-03-03  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/104757
            * gimplify.cc (gimplify_omp_loop): Call gimplify_expr rather than
            gimplify_omp_for.
            (gimplify_expr) <case OMP_SIMD>: Temporarily disable
            gimplify_ctxp->into_ssa around call to gimplify_omp_for.

            * gfortran.dg/gomp/pr104757.f90: New test.
            * gcc.dg/gomp/pr104757.c: New test.

Reply via email to