Patchwork patch: remove is_gimple_non_addressable

login
register
mail settings
Submitter Aldy Hernandez
Date Jan. 5, 2012, 2:48 p.m.
Message ID <4F05B833.7000907@redhat.com>
Download mbox | patch
Permalink /patch/134487/
State New
Headers show

Comments

Aldy Hernandez - Jan. 5, 2012, 2:48 p.m.
As you suggested here:

http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00232.html

Bootregged on x86-64 Linux.

OK?
* gimple.c (is_gimple_non_addressable): Remove.
	* gimple.h: Remove is_gimple_non_addressable.
	* gimplify.c (gimplify_modify_expr_rhs): Use is_gimple_reg instead of
	is_gimple_non_addressable.
	* trans-mem.c (expand_assign_tm): Same.
Richard Guenther - Jan. 5, 2012, 3:36 p.m.
On Thu, Jan 5, 2012 at 3:48 PM, Aldy Hernandez <aldyh@redhat.com> wrote:
> As you suggested here:
>
> http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00232.html
>
> Bootregged on x86-64 Linux.
>
> OK?

No, this pessimizes things too much at gimplification time, please simply
inline the predicate instead.

Richard.

Patch

Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 182908)
+++ trans-mem.c	(working copy)
@@ -2184,7 +2184,7 @@  expand_assign_tm (struct tm_region *regi
       /* ??? Figure out if there's any possible overlap between the LHS
 	 and the RHS and if not, use MEMCPY.  */
 
-      if (load_p && is_gimple_non_addressable (lhs))
+      if (load_p && is_gimple_reg (lhs))
 	{
 	  tmp = create_tmp_var (TREE_TYPE (lhs), NULL);
 	  lhs_addr = build_fold_addr_expr (tmp);
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 182848)
+++ gimplify.c	(working copy)
@@ -4411,7 +4411,7 @@  gimplify_modify_expr_rhs (tree *expr_p,
 		/* It's OK to use the target directly if it's being
 		   initialized. */
 		use_target = true;
-	      else if (!is_gimple_non_addressable (*to_p))
+	      else if (!is_gimple_reg (*to_p))
 		/* Don't use the original target if it's already addressable;
 		   if its address escapes, and the called function uses the
 		   NRV optimization, a conforming program could see *to_p
Index: gimple.c
===================================================================
--- gimple.c	(revision 182848)
+++ gimple.c	(working copy)
@@ -2963,17 +2963,6 @@  is_gimple_reg (tree t)
 }
 
 
-/* Return true if T is a GIMPLE variable whose address is not needed.  */
-
-bool
-is_gimple_non_addressable (tree t)
-{
-  if (TREE_CODE (t) == SSA_NAME)
-    t = SSA_NAME_VAR (t);
-
-  return (is_gimple_variable (t) && ! needs_to_live_in_memory (t));
-}
-
 /* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant.  */
 
 bool
Index: gimple.h
===================================================================
--- gimple.h	(revision 182848)
+++ gimple.h	(working copy)
@@ -1006,9 +1006,6 @@  extern bool is_gimple_mem_rhs (tree);
 /* Returns true iff T is a valid if-statement condition.  */
 extern bool is_gimple_condexpr (tree);
 
-/* Returns true iff T is a variable that does not need to live in memory.  */
-extern bool is_gimple_non_addressable (tree t);
-
 /* Returns true iff T is a valid call address expression.  */
 extern bool is_gimple_call_addr (tree);