From: Alexander Monakov Date: Fri, 20 Jan 2017 14:38:18 +0000 (+0300) Subject: omp-offload: use PROP_gimple_lomp_dev X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4cea8675697151f7e8c5b30259da9ac0971ab070;p=gcc.git omp-offload: use PROP_gimple_lomp_dev * omp-expand.c (expand_omp_simd): Clear PROP_gimple_lomp_dev regardless of safelen status. * omp-offload.c (pass_omp_device_lower::gate): Use PROP_gimple_lomp_dev. * passes.c (dump_properties): Handle PROP_gimple_lomp_dev. * tree-inline.c (expand_call_inline): Propagate PROP_gimple_lomp_dev. From-SVN: r244717 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 760869e04c5..0b3d0c98bb0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-01-20 Alexander Monakov + + * omp-expand.c (expand_omp_simd): Clear PROP_gimple_lomp_dev regardless + of safelen status. + * omp-offload.c (pass_omp_device_lower::gate): Use PROP_gimple_lomp_dev. + * passes.c (dump_properties): Handle PROP_gimple_lomp_dev. + * tree-inline.c (expand_call_inline): Propagate PROP_gimple_lomp_dev. + 2017-01-20 Kyrylo Tkachov PR target/71270 diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 57d9fdea85a..d3891e3175e 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -4590,13 +4590,16 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) } tree step = fd->loop.step; - bool is_simt = (safelen_int > 1 - && omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), - OMP_CLAUSE__SIMT_)); - tree simt_lane = NULL_TREE, simt_maxlane = NULL_TREE; + bool is_simt = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), + OMP_CLAUSE__SIMT_); if (is_simt) { cfun->curr_properties &= ~PROP_gimple_lomp_dev; + is_simt = safelen_int > 1; + } + tree simt_lane = NULL_TREE, simt_maxlane = NULL_TREE; + if (is_simt) + { simt_lane = create_tmp_var (unsigned_type_node); gimple *g = gimple_build_call_internal (IFN_GOMP_SIMT_LANE, 0); gimple_call_set_lhs (g, simt_lane); diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index 77e003d5b56..6ff6bc2eeb9 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -1613,14 +1613,9 @@ public: {} /* opt_pass methods: */ - virtual bool gate (function *ARG_UNUSED (fun)) + virtual bool gate (function *fun) { - /* FIXME: this should use PROP_gimple_lomp_dev. */ -#ifdef ACCEL_COMPILER - return true; -#else - return ENABLE_OFFLOADING && (flag_openmp || in_lto_p); -#endif + return !(fun->curr_properties & PROP_gimple_lomp_dev); } virtual unsigned int execute (function *) { diff --git a/gcc/passes.c b/gcc/passes.c index 31262edbd09..ace68b8ee7a 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -2929,6 +2929,8 @@ dump_properties (FILE *dump, unsigned int props) fprintf (dump, "PROP_rtl\n"); if (props & PROP_gimple_lomp) fprintf (dump, "PROP_gimple_lomp\n"); + if (props & PROP_gimple_lomp_dev) + fprintf (dump, "PROP_gimple_lomp_dev\n"); if (props & PROP_gimple_lcx) fprintf (dump, "PROP_gimple_lcx\n"); if (props & PROP_gimple_lvec) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index ac72039f12a..42055bd8318 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4413,6 +4413,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) bool purge_dead_abnormal_edges; gcall *call_stmt; unsigned int i; + unsigned int prop_mask, src_properties; /* The gimplifier uses input_location in too many places, such as internal_get_tmp_var (). */ @@ -4617,11 +4618,13 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) id->call_stmt = stmt; /* If the src function contains an IFN_VA_ARG, then so will the dst - function after inlining. */ - if ((id->src_cfun->curr_properties & PROP_gimple_lva) == 0) + function after inlining. Likewise for IFN_GOMP_USE_SIMT. */ + prop_mask = PROP_gimple_lva | PROP_gimple_lomp_dev; + src_properties = id->src_cfun->curr_properties & prop_mask; + if (src_properties != prop_mask) { struct function *dst_cfun = DECL_STRUCT_FUNCTION (id->dst_fn); - dst_cfun->curr_properties &= ~PROP_gimple_lva; + dst_cfun->curr_properties &= src_properties | ~prop_mask; } gcc_assert (!id->src_cfun->after_inlining);