public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Remove some useless work in PRE
@ 2017-11-17  9:16 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2017-11-17  9:16 UTC (permalink / raw)
  To: gcc-patches


VN already sees if an expresion is fully constant so there's no reason
to duplicate that work during PHI translation.  I've verified with
an assert the paths are indeed unreachable.

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

Richard.

2017-11-17  Richard Biener  <rguenther@suse.de>

	* tree-ssa-pre.c (phi_translate_1): Remove redundant constant
	folding of references.

Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c	(revision 254797)
+++ gcc/tree-ssa-pre.c	(working copy)
@@ -1566,7 +1566,6 @@ phi_translate_1 (pre_expr expr, bitmap_s
 	if (changed || newvuse != vuse)
 	  {
 	    unsigned int new_val_id;
-	    pre_expr constant;
 
 	    tree result = vn_reference_lookup_pieces (newvuse, ref->set,
 						      ref->type,
@@ -1611,15 +1610,7 @@ phi_translate_1 (pre_expr expr, bitmap_s
 	    expr->id = 0;
 
 	    if (newref)
-	      {
-		PRE_EXPR_REFERENCE (expr) = newref;
-		constant = fully_constant_expression (expr);
-		if (constant != expr)
-		  return constant;
-
-		new_val_id = newref->value_id;
-		get_or_alloc_expression_id (expr);
-	      }
+	      new_val_id = newref->value_id;
 	    else
 	      {
 		if (changed || !same_valid)
@@ -1637,12 +1628,9 @@ phi_translate_1 (pre_expr expr, bitmap_s
 						     newoperands,
 						     result, new_val_id);
 		newoperands = vNULL;
-		PRE_EXPR_REFERENCE (expr) = newref;
-		constant = fully_constant_expression (expr);
-		if (constant != expr)
-		  return constant;
-		get_or_alloc_expression_id (expr);
 	      }
+	    PRE_EXPR_REFERENCE (expr) = newref;
+	    get_or_alloc_expression_id (expr);
 	    add_to_value (new_val_id, expr);
 	  }
 	newoperands.release ();

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

only message in thread, other threads:[~2017-11-17  9:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17  9:16 [PATCH] Remove some useless work in PRE Richard Biener

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).