]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
amdgcn: Remove omp_gcn pass
authorAndrew Stubbs <ams@codesourcery.com>
Thu, 17 Sep 2020 11:48:21 +0000 (12:48 +0100)
committerAndrew Stubbs <ams@codesourcery.com>
Fri, 18 Sep 2020 10:13:07 +0000 (11:13 +0100)
This pass only had an optimization for obtaining team/thread numbers in it,
and that turns out to be invalid in the presence of nested parallel regions,
so we can simply delete the whole thing.

Of course, it would be nice to apply the optimization where it is valid, but
that will take more effort than I have to spend right now.

gcc/ChangeLog:

* config/gcn/gcn-tree.c (execute_omp_gcn): Delete.
(make_pass_omp_gcn): Delete.
* config/gcn/t-gcn-hsa (PASSES_EXTRA): Delete.
* config/gcn/gcn-passes.def: Removed.

gcc/config/gcn/gcn-passes.def [deleted file]
gcc/config/gcn/gcn-tree.c
gcc/config/gcn/t-gcn-hsa

diff --git a/gcc/config/gcn/gcn-passes.def b/gcc/config/gcn/gcn-passes.def
deleted file mode 100644 (file)
index bcf928d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2017-2020 Free Software Foundation, Inc.
-
-   This file is part of GCC.
-   
-   GCC is free software; you can redistribute it and/or modify it under
-   the terms of the GNU General Public License as published by the Free
-   Software Foundation; either version 3, or (at your option) any later
-   version.
-   
-   GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or
-   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-   for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with GCC; see the file COPYING3.  If not see
-   <http://www.gnu.org/licenses/>.  */
-
-INSERT_PASS_AFTER (pass_omp_target_link, 1, pass_omp_gcn);
index a681426139b083683cc786bd9c850daf58d782c7..4304f13160ae7915c94ec6cb13b33b31085d271d 100644 (file)
 #include "targhooks.h"
 #include "langhooks-def.h"
 
-/* }}}  */
-/* {{{ OMP GCN pass.
-   This pass is intended to make any GCN-specfic transformations to OpenMP
-   target regions.
-   At present, its only purpose is to convert some "omp" built-in functions
-   to use closer-to-the-metal "gcn" built-in functions.  */
-
-unsigned int
-execute_omp_gcn (void)
-{
-  tree thr_num_tree = builtin_decl_explicit (BUILT_IN_OMP_GET_THREAD_NUM);
-  tree thr_num_id = DECL_NAME (thr_num_tree);
-  tree team_num_tree = builtin_decl_explicit (BUILT_IN_OMP_GET_TEAM_NUM);
-  tree team_num_id = DECL_NAME (team_num_tree);
-  basic_block bb;
-  gimple_stmt_iterator gsi;
-  unsigned int todo = 0;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
-    {
-      gimple *call = gsi_stmt (gsi);
-      tree decl;
-
-      if (is_gimple_call (call) && (decl = gimple_call_fndecl (call)))
-       {
-         tree decl_id = DECL_NAME (decl);
-         tree lhs = gimple_get_lhs (call);
-
-         if (decl_id == thr_num_id)
-           {
-             if (dump_file && (dump_flags & TDF_DETAILS))
-               fprintf (dump_file,
-                        "Replace '%s' with __builtin_gcn_dim_pos.\n",
-                        IDENTIFIER_POINTER (decl_id));
-
-             /* Transform this:
-                lhs = __builtin_omp_get_thread_num ()
-                to this:
-                lhs = __builtin_gcn_dim_pos (1)  */
-             tree fn = targetm.builtin_decl (GCN_BUILTIN_OMP_DIM_POS, 0);
-             tree fnarg = build_int_cst (unsigned_type_node, 1);
-             gimple *stmt = gimple_build_call (fn, 1, fnarg);
-             gimple_call_set_lhs (stmt, lhs);
-             gsi_replace (&gsi, stmt, true);
-
-             todo |= TODO_update_ssa;
-           }
-         else if (decl_id == team_num_id)
-           {
-             if (dump_file && (dump_flags & TDF_DETAILS))
-               fprintf (dump_file,
-                        "Replace '%s' with __builtin_gcn_dim_pos.\n",
-                        IDENTIFIER_POINTER (decl_id));
-
-             /* Transform this:
-                lhs = __builtin_omp_get_team_num ()
-                to this:
-                lhs = __builtin_gcn_dim_pos (0)  */
-             tree fn = targetm.builtin_decl (GCN_BUILTIN_OMP_DIM_POS, 0);
-             tree fnarg = build_zero_cst (unsigned_type_node);
-             gimple *stmt = gimple_build_call (fn, 1, fnarg);
-             gimple_call_set_lhs (stmt, lhs);
-             gsi_replace (&gsi, stmt, true);
-
-             todo |= TODO_update_ssa;
-           }
-       }
-    }
-
-  return todo;
-}
-
-namespace
-{
-
-  const pass_data pass_data_omp_gcn = {
-    GIMPLE_PASS,
-    "omp_gcn",                 /* name */
-    OPTGROUP_NONE,             /* optinfo_flags */
-    TV_NONE,                   /* tv_id */
-    0,                         /* properties_required */
-    0,                         /* properties_provided */
-    0,                         /* properties_destroyed */
-    0,                         /* todo_flags_start */
-    TODO_df_finish,            /* todo_flags_finish */
-  };
-
-  class pass_omp_gcn : public gimple_opt_pass
-  {
-  public:
-    pass_omp_gcn (gcc::context *ctxt)
-      : gimple_opt_pass (pass_data_omp_gcn, ctxt)
-    {
-    }
-
-    /* opt_pass methods: */
-    virtual bool gate (function *)
-    {
-      return flag_openmp;
-    }
-
-    virtual unsigned int execute (function *)
-    {
-      return execute_omp_gcn ();
-    }
-
-  }; /* class pass_omp_gcn.  */
-
-} /* anon namespace.  */
-
-gimple_opt_pass *
-make_pass_omp_gcn (gcc::context *ctxt)
-{
-  return new pass_omp_gcn (ctxt);
-}
-
 /* }}}  */
 /* {{{ OpenACC reductions.  */
 
index af203c5cf057f1a77d0e8d3c9621226331402c55..16d243c3f2ba8b6083a039aa376e842cf8b48721 100644 (file)
@@ -45,7 +45,6 @@ gcn-run$(exeext): gcn-run.o
 MULTILIB_OPTIONS = march=gfx900/march=gfx906
 MULTILIB_DIRNAMES = gfx900 gfx906
 
-PASSES_EXTRA += $(srcdir)/config/gcn/gcn-passes.def
 gcn-tree.o: $(srcdir)/config/gcn/gcn-tree.c
        $(COMPILE) $<
        $(POSTCOMPILE)