Patchwork Simplify get_prop_source_stmt

login
register
mail settings
Submitter Richard Guenther
Date Sept. 19, 2012, 10:58 a.m.
Message ID <alpine.LNX.2.00.1209191258112.28649@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/184973/
State New
Headers show

Comments

Richard Guenther - Sept. 19, 2012, 10:58 a.m.
Pointer conversions are useless for quite some time, so simplify
get_prop_source_stmt.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-09-19  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-forwprop.c (get_prop_source_stmt): Simplify.

Patch

Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c	(revision 191463)
+++ gcc/tree-ssa-forwprop.c	(working copy)
@@ -227,29 +227,15 @@  get_prop_source_stmt (tree name, bool si
     if (!is_gimple_assign (def_stmt))
       return NULL;
 
-    /* If def_stmt is not a simple copy, we possibly found it.  */
-    if (!gimple_assign_ssa_name_copy_p (def_stmt))
+    /* If def_stmt is a simple copy, continue looking.  */
+    if (gimple_assign_rhs_code (def_stmt) == SSA_NAME)
+      name = gimple_assign_rhs1 (def_stmt);
+    else
       {
-	tree rhs;
-
 	if (!single_use_only && single_use_p)
 	  *single_use_p = single_use;
 
-	/* We can look through pointer conversions in the search
-	   for a useful stmt for the comparison folding.  */
-	rhs = gimple_assign_rhs1 (def_stmt);
-	if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))
-	    && TREE_CODE (rhs) == SSA_NAME
-	    && POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (def_stmt)))
-	    && POINTER_TYPE_P (TREE_TYPE (rhs)))
-	  name = rhs;
-	else
-	  return def_stmt;
-      }
-    else
-      {
-	/* Continue searching the def of the copy source name.  */
-	name = gimple_assign_rhs1 (def_stmt);
+	return def_stmt;
       }
   } while (1);
 }