[28/40] openacc: Disable pass_pre on outlined functions analyzed by Graphite

Message ID 20211215155447.19379-29-frederik@codesourcery.com
State New
Headers
Series OpenACC "kernels" Improvements |

Commit Message

Frederik Harwath Dec. 15, 2021, 3:54 p.m. UTC
  The additional dependences introduced by partial redundancy
elimination proper and by the code hoisting step of the pass very
often cause Graphite to fail on OpenACC functions. On the other hand,
the pass can also enable the analysis of OpenACC loops (cf. e.g. the
loop-auto-transfer-4.f90 testcase), for instance, because full
redundancy elimination removes definitions that would otherwise
prevent the creation of runtime alias checks outside of the SCoP.

This commit disables the actual partial redundancy elimination step as
well as the code hoisting step of pass_pre on OpenACC functions that
might be handled by Graphite.

gcc/ChangeLog:

        * tree-ssa-pre.c (insert): Skip any insertions in OpenACC
        functions that might be processed by Graphite.
---
 gcc/tree-ssa-pre.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--
2.33.0

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Patch

diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index dc55d868cc19..d61210fc2ee9 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -52,6 +52,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-cfgcleanup.h"
 #include "alias.h"
 #include "gimple-range.h"
+#include "graphite-oacc.h"

 /* Even though this file is called tree-ssa-pre.c, we actually
    implement a bit more than just PRE here.  All of them piggy-back
@@ -3742,6 +3743,22 @@  do_hoist_insertion (basic_block block)
 static void
 insert (void)
 {
+
+    /* The additional dependences introduced by the code insertions
+     can cause Graphite's dependence analysis to fail .  Without
+     special handling of those dependences in Graphite, it seems
+     better to skip this step if OpenACC loops that need to be handled
+     by Graphite are found.  Note that the full redundancy elimination
+     step of this pass is useful for the purpose of dependence
+     analysis, for instance, because it can remove definitions from
+     SCoPs that would otherwise prevent the creation of runtime alias
+     checks since those may only use definitions that are available
+     before the SCoP. */
+
+  if (oacc_function_p (cfun)
+      && ::graphite_analyze_oacc_function_p (cfun))
+    return;
+
   basic_block bb;

   FOR_ALL_BB_FN (bb, cfun)