public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH GCC][05/06]An interface clear all dependence_info with fixed access length tag
@ 2017-08-14  9:32 Bin Cheng
  0 siblings, 0 replies; only message in thread
From: Bin Cheng @ 2017-08-14  9:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

Hi,
Given tree node (thus struct dependence_info) is kept and shadow copied on RTL,
it is unsafe to pass non-dependent info to RTL in case of loop unrolling etc.
This patch adds an interface clearing all dependence_info with fixed access
length tag before entering RTL world.  We could do it just before expanding,
but for now it is done in loopdone given predcom is the only motivation pass
that I know.
Bootstrap and test in series.  Is it OK?

Thanks,
bin
2017-08-10  Bin Cheng  <bin.cheng@arm.com>

	* tree-ssa-address.c (clear_dependence_info): New function.
	(clear_all_dependence_info): New function.
	* tree-ssa-address.h (clear_all_dependence_info): New declaration.
	* tree-ssa-loop.c: Include tree-ssa-address.h.
	(tree_ssa_loop_done): Call clear_all_dependence_info.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-clear-fixed-dep_info-20170801.txt.patch --]
[-- Type: text/x-patch; name="0005-clear-fixed-dep_info-20170801.txt.patch", Size: 2955 bytes --]

From b54fa9745b3bd84cb44baf9dbee2379fa9e28362 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binche01@e108451-lin.cambridge.arm.com>
Date: Wed, 9 Aug 2017 15:40:38 +0100
Subject: [PATCH 5/6] clear-fixed-dep_info-20170801.txt

---
 gcc/tree-ssa-address.c | 40 ++++++++++++++++++++++++++++++++++++++++
 gcc/tree-ssa-address.h |  1 +
 gcc/tree-ssa-loop.c    |  2 ++
 3 files changed, 43 insertions(+)

diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index aea1730..33cfab1 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -975,6 +975,46 @@ copy_dependence_info (tree to, tree from)
   MR_DEPENDENCE_FIXED_LENGTH_P (to) = MR_DEPENDENCE_FIXED_LENGTH_P (from);
 }
 
+/* Clear dependence information in REF if it's for fixed access length.  */
+
+static inline void
+clear_dependence_info (tree ref)
+{
+  if ((TREE_CODE (ref) != MEM_REF && TREE_CODE (ref) != TARGET_MEM_REF)
+      || !MR_DEPENDENCE_FIXED_LENGTH_P (ref))
+    return;
+
+  MR_DEPENDENCE_CLIQUE (ref) = 0;
+  MR_DEPENDENCE_BASE (ref) = 0;
+  MR_DEPENDENCE_FIXED_LENGTH_P (ref) = false;
+}
+
+/* Clear all dependence information which is for fixed access length.  */
+
+void
+clear_all_dependence_info ()
+{
+  basic_block bb;
+
+  FOR_EACH_BB_FN (bb, cfun)
+    {
+      for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
+	   !gsi_end_p (gsi); gsi_next (&gsi))
+	{
+	  gimple *stmt = gsi_stmt (gsi);
+	  if (!is_gimple_assign (stmt))
+	    continue;
+
+	  enum tree_code code = gimple_assign_rhs_code (stmt);
+	  if (get_gimple_rhs_class (code) != GIMPLE_SINGLE_RHS)
+	    continue;
+
+	  clear_dependence_info (gimple_assign_lhs (stmt));
+	  clear_dependence_info (gimple_assign_rhs1 (stmt));
+	}
+    }
+}
+
 /* Copies the reference information from OLD_REF to NEW_REF, where
    NEW_REF should be either a MEM_REF or a TARGET_MEM_REF.  */
 
diff --git a/gcc/tree-ssa-address.h b/gcc/tree-ssa-address.h
index ebba5ad..71d24a9 100644
--- a/gcc/tree-ssa-address.h
+++ b/gcc/tree-ssa-address.h
@@ -37,6 +37,7 @@ extern void move_fixed_address_to_symbol (struct mem_address *,
 tree create_mem_ref (gimple_stmt_iterator *, tree,
 		     struct aff_tree *, tree, tree, tree, bool);
 extern void copy_dependence_info (tree, tree);
+extern void clear_all_dependence_info ();
 extern void copy_ref_info (tree, tree);
 tree maybe_fold_tmr (tree);
 
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 1e84917..0de00eb 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa-loop-manip.h"
 #include "tree-ssa-loop-niter.h"
 #include "tree-ssa-loop.h"
+#include "tree-ssa-address.h"
 #include "cfgloop.h"
 #include "tree-inline.h"
 #include "tree-scalar-evolution.h"
@@ -517,6 +518,7 @@ tree_ssa_loop_done (void)
   free_numbers_of_iterations_estimates (cfun);
   scev_finalize ();
   loop_optimizer_finalize ();
+  clear_all_dependence_info ();
   return 0;
 }
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-14  9:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14  9:32 [PATCH GCC][05/06]An interface clear all dependence_info with fixed access length tag Bin Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).