This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][RFC] Tuplify PRE and some more stuff



This is a big patch that apart from tuplifying PRE does


 - allow printing RHS of a stmt only (with a TDF_RHS_ONLY flag hack)
   this reduces the difference between tuples and trunk dump files
   and for example makes all VRP tests magically pass.
   (I don't like that we change testcases on the branch to match what
   we see there -- it is too easy to miss a difference in code this way)

- fix some bugs in the SCCVN conversion

- adds some gimple helpers and fixes some

 - re-adds some of the SCCVN insertion code (I'll move that to trunk
   as well)

the fake store insertion is not converted as it is disabled on the
trunk anyway.

The patch sofar passes C only bootstrap (all languages bootstrap
dies in building libstdc++ PCH ...), most of the PRE/FRE tests pass but
I didn't yet produce a baseline to compare testresults against.

Full testing (w/ PCH disabled) still running.

Should I split the patch?

Thanks,
Richard.


2008-07-09 Richard Guenther <rguenther@suse.de>


	* gimple.h (gimple_assign_ssa_name_copy_p): Declare.
	(gimple_has_lhs): New function.
	* gimple.c (gimple_assign_ssa_name_copy_p): New function.
	* tree-ssa-pre.c: Tuplify.  Enable FRE and PRE.
	(get_or_alloc_expr_for): Handle n-ary expressions.
	* tree-ssa-sccvn.h (copy_reference_ops_from_call): Declare.
	* tree-ssa-sccvn.c (copy_reference_ops_from_call): Export.
	(vn_get_expr_for): Always hand out conversions.
	(visit_reference_op_load): Properly set a value id for
	inserted names.
	(simplify_binary_expression): Use valid_gimple_rhs_p instead of
	valid_gimple_expression_p.
	(simplify_unary_expression): Likewise.
	(set_ssa_val_to): Clear the cached expression.
	* tree-ssa-copy.c (propagate_tree_value_into_stmt): Remove
	redundant gimple_set_location call.
	* gimple-pretty-print.c (print_gimple_stmt): Do not flush if
	TDF_RHS_ONLY.
	(dump_gimple_assign): Dump the RHS as expression if TDF_RHS_ONLY.
	(dump_gimple_call): Likewise.
	(dump_gimple_cond): Likewise.
	* tree-pass.h (TDF_RHS_ONLY): New flag.

* testsuite/gcc.dg/tree-ssa/pr25485.c: Revert to trunk version.

Index: gimple-tuples-branch/gcc/gimple.c
===================================================================
*** gimple-tuples-branch.orig/gcc/gimple.c	2008-07-09 10:43:44.000000000 +0200
--- gimple-tuples-branch/gcc/gimple.c	2008-07-09 10:56:13.000000000 +0200
*************** gimple_assign_copy_p (gimple gs)
*** 1838,1843 ****
--- 1838,1857 ----
  	 && is_gimple_val (gimple_op (gs, 1));
  }

+ + /* Return true if GS is a SSA_NAME copy assignment. */
+ + bool
+ gimple_assign_ssa_name_copy_p (gimple gs)
+ {
+ return (gimple_code (gs) == GIMPLE_ASSIGN
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (gs))
+ == GIMPLE_SINGLE_RHS)
+ && TREE_CODE (gimple_assign_lhs (gs)) == SSA_NAME
+ && TREE_CODE (gimple_assign_rhs1 (gs)) == SSA_NAME);
+ }
+ +
/* Return true if GS is an assignment with a singleton RHS, i.e.,
there is no operator associated with the assignment itself.
Unlike gimple_assign_copy_p, this predicate returns true for
Index: gimple-tuples-branch/gcc/gimple.h
===================================================================
*** gimple-tuples-branch.orig/gcc/gimple.h 2008-07-09 10:43:44.000000000 +0200
--- gimple-tuples-branch/gcc/gimple.h 2008-07-09 10:56:13.000000000 +0200
*************** void gimple_seq_add_seq (gimple_seq *, g
*** 821,826 ****
--- 821,827 ----
gimple_seq gimple_seq_copy (gimple_seq);
int gimple_call_flags (const_gimple);
bool gimple_assign_copy_p (gimple);
+ bool gimple_assign_ssa_name_copy_p (gimple);
bool gimple_assign_single_p (gimple);
bool gimple_assign_unary_nop_p (gimple);
void gimple_set_bb (gimple, struct basic_block_def *);
*************** gimple_call_copy_flags (gimple dest_call
*** 2013,2018 ****
--- 2014,2031 ----
}



+ /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
+ non-NULL lhs. */
+ + static inline bool
+ gimple_has_lhs (gimple stmt)
+ {
+ return (is_gimple_assign (stmt)
+ || (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt) != NULL_TREE));
+ }
+ +
/* Return the code of the predicate computed by conditional statement GS. */


  static inline enum tree_code
Index: gimple-tuples-branch/gcc/tree-ssa-pre.c
===================================================================
*** gimple-tuples-branch.orig/gcc/tree-ssa-pre.c	2008-07-09 10:43:44.000000000 +0200
--- gimple-tuples-branch/gcc/tree-ssa-pre.c	2008-07-09 17:46:28.000000000 +0200
*************** along with GCC; see the file COPYING3.
*** 48,55 ****
  #include "params.h"
  #include "dbgcnt.h"

- /* FIXME tuples.  */
- #if 0
  /* TODO:

     1. Avail sets can be shared by making an avail_find_leader that
--- 48,53 ----
*************** static struct
*** 424,430 ****
  } pre_stats;

  static bool do_partial_partial;
! static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int , tree);
  static void bitmap_value_insert_into_set (bitmap_set_t, pre_expr);
  static void bitmap_value_replace_in_set (bitmap_set_t, pre_expr);
  static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
--- 422,428 ----
  } pre_stats;

  static bool do_partial_partial;
! static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int, gimple);
  static void bitmap_value_insert_into_set (bitmap_set_t, pre_expr);
  static void bitmap_value_replace_in_set (bitmap_set_t, pre_expr);
  static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
*************** static bool bitmap_set_contains_value (b
*** 432,440 ****
  static void bitmap_insert_into_set (bitmap_set_t, pre_expr);
  static void bitmap_insert_into_set_1 (bitmap_set_t, pre_expr, bool);
  static bitmap_set_t bitmap_set_new (void);
! static tree create_expression_by_pieces (basic_block, pre_expr, tree, tree,
! 					 tree);
! static tree find_or_generate_expression (basic_block, pre_expr, tree, tree);

  /* We can add and remove elements and entries to and from sets
     and hash tables, so we use alloc pools for them.  */
--- 430,439 ----
  static void bitmap_insert_into_set (bitmap_set_t, pre_expr);
  static void bitmap_insert_into_set_1 (bitmap_set_t, pre_expr, bool);
  static bitmap_set_t bitmap_set_new (void);
! static tree create_expression_by_pieces (basic_block, pre_expr, gimple_seq *,
! 					 gimple, tree);
! static tree find_or_generate_expression (basic_block, pre_expr, gimple_seq *,
! 					 gimple);

  /* We can add and remove elements and entries to and from sets
     and hash tables, so we use alloc pools for them.  */
*************** get_or_alloc_expr_for (tree t)
*** 1038,1043 ****
--- 1037,1057 ----
      return get_or_alloc_expr_for_name (t);
    else if (is_gimple_min_invariant (t))
      return get_or_alloc_expr_for_constant (t);
+   else if (UNARY_CLASS_P (t)
+ 	   || BINARY_CLASS_P (t)
+ 	   || COMPARISON_CLASS_P (t)
+ 	   || TREE_CODE (t) == ADDR_EXPR)
+     {
+       vn_nary_op_t result;
+       if (vn_nary_op_lookup (t, &result) != NULL_TREE)
+ 	{
+ 	  pre_expr e = (pre_expr) pool_alloc (pre_expr_pool);
+ 	  e->kind = NARY;
+ 	  e->u.nary = result;
+ 	  alloc_expression_id (e);
+ 	  return e;
+ 	}
+     }
    return NULL;
  }

*************** translate_vuses_through_block (VEC (tree
*** 1116,1123 ****

    for (i = 0; VEC_iterate (tree, vuses, i, oldvuse); i++)
      {
!       tree phi = SSA_NAME_DEF_STMT (oldvuse);
!       if (TREE_CODE (phi) == PHI_NODE
  	  && gimple_bb (phi) == phiblock)
  	{
  	  edge e = find_edge (block, gimple_bb (phi));
--- 1130,1137 ----

    for (i = 0; VEC_iterate (tree, vuses, i, oldvuse); i++)
      {
!       gimple phi = SSA_NAME_DEF_STMT (oldvuse);
!       if (gimple_code (phi) == GIMPLE_PHI
  	  && gimple_bb (phi) == phiblock)
  	{
  	  edge e = find_edge (block, gimple_bb (phi));
*************** find_leader_in_sets (unsigned int val, b
*** 1154,1162 ****
  {
    pre_expr result;

!   result = bitmap_find_leader (set1, val, NULL_TREE);
    if (!result && set2)
!     result = bitmap_find_leader (set2, val, NULL_TREE);
    return result;
  }

--- 1168,1176 ----
  {
    pre_expr result;

!   result = bitmap_find_leader (set1, val, NULL);
    if (!result && set2)
!     result = bitmap_find_leader (set2, val, NULL);
    return result;
  }

*************** get_representative_for (const pre_expr e
*** 1255,1261 ****
        get_var_ann (pretemp);
      }

!   name = make_ssa_name (pretemp, build_empty_stmt ());
    VN_INFO_GET (name)->value_id = value_id;
    if (e->kind == CONSTANT)
      VN_INFO (name)->valnum = PRE_EXPR_CONSTANT (e);
--- 1269,1275 ----
        get_var_ann (pretemp);
      }

!   name = make_ssa_name (pretemp, gimple_build_nop ());
    VN_INFO_GET (name)->value_id = value_id;
    if (e->kind == CONSTANT)
      VN_INFO (name)->valnum = PRE_EXPR_CONSTANT (e);
*************** phi_translate_1 (pre_expr expr, bitmap_s
*** 1543,1555 ****
        break;
      case NAME:
        {
! 	tree phi = NULL;
  	edge e;
  	gimple def_stmt;
  	tree name = PRE_EXPR_NAME (expr);

  	def_stmt = SSA_NAME_DEF_STMT (name);
! 	if (TREE_CODE (def_stmt) == PHI_NODE
  	    && gimple_bb (def_stmt) == phiblock)
  	  phi = def_stmt;
  	else
--- 1557,1569 ----
        break;
      case NAME:
        {
! 	gimple phi = NULL;
  	edge e;
  	gimple def_stmt;
  	tree name = PRE_EXPR_NAME (expr);

  	def_stmt = SSA_NAME_DEF_STMT (name);
! 	if (gimple_code (def_stmt) == GIMPLE_PHI
  	    && gimple_bb (def_stmt) == phiblock)
  	  phi = def_stmt;
  	else
*************** value_dies_in_block_x (pre_expr expr, ba
*** 1705,1715 ****
       rather than stores.  */
    for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
      {
!       tree def = SSA_NAME_DEF_STMT (vuse);

        if (gimple_bb (def) != block)
  	continue;
!       if (TREE_CODE (def) == PHI_NODE)
  	continue;
        return true;
      }
--- 1719,1729 ----
       rather than stores.  */
    for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
      {
!       gimple def = SSA_NAME_DEF_STMT (vuse);

        if (gimple_bb (def) != block)
  	continue;
!       if (gimple_code (def) == GIMPLE_PHI)
  	continue;
        return true;
      }
*************** can_value_number_call (gimple stmt)
*** 2325,2333 ****
     FILTER_EXPR or EXC_PTR_EXPR.  */

  static bool
! is_exception_related (tree op)
  {
!   return TREE_CODE (op) == FILTER_EXPR || TREE_CODE (op) == EXC_PTR_EXPR;
  }

  /* Return true if OP is a tree which we can perform PRE on
--- 2339,2349 ----
     FILTER_EXPR or EXC_PTR_EXPR.  */

  static bool
! is_exception_related (gimple stmt)
  {
!   return (gimple_code (stmt) == GIMPLE_ASSIGN
! 	  && (gimple_assign_rhs_code (stmt) == FILTER_EXPR
! 	      || gimple_assign_rhs_code (stmt) == EXC_PTR_EXPR));
  }

  /* Return true if OP is a tree which we can perform PRE on
*************** can_PRE_operation (tree op)
*** 2351,2362 ****
  /* Inserted expressions are placed onto this worklist, which is used
     for performing quick dead code elimination of insertions we made
     that didn't turn out to be necessary.   */
! static VEC(tree,heap) *inserted_exprs;

  /* Pool allocated fake store expressions are placed onto this
     worklist, which, after performing dead code elimination, is walked
     to see which expressions need to be put into GC'able memory  */
! static VEC(tree, heap) *need_creation;

  /* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
     COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
--- 2367,2378 ----
  /* Inserted expressions are placed onto this worklist, which is used
     for performing quick dead code elimination of insertions we made
     that didn't turn out to be necessary.   */
! static VEC(gimple,heap) *inserted_exprs;

  /* Pool allocated fake store expressions are placed onto this
     worklist, which, after performing dead code elimination, is walked
     to see which expressions need to be put into GC'able memory  */
! static VEC(gimple, heap) *need_creation;

  /* For COMPONENT_REF's and ARRAY_REF's, we can't have any intermediates for the
     COMPONENT_REF or INDIRECT_REF or ARRAY_REF portion, because we'd end up with
*************** static VEC(tree, heap) *need_creation;
*** 2374,2381 ****
  static tree
  create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
  				unsigned int operand,
! 				tree stmts,
! 				tree domstmt,
  				bool in_call)
  {
    vn_reference_op_t currop = VEC_index (vn_reference_op_s, ref->operands,
--- 2390,2397 ----
  static tree
  create_component_ref_by_pieces (basic_block block, vn_reference_t ref,
  				unsigned int operand,
! 				gimple_seq *stmts,
! 				gimple domstmt,
  				bool in_call)
  {
    vn_reference_op_t currop = VEC_index (vn_reference_op_s, ref->operands,
*************** create_component_ref_by_pieces (basic_bl
*** 2398,2404 ****
  						      operand + 2 + i, stmts,
  						      domstmt, true);
  	  }
! 	folded = build_call_array (currop->type, declop->op0, nargs, args);
  	free (args);
  	return folded;
        }
--- 2414,2424 ----
  						      operand + 2 + i, stmts,
  						      domstmt, true);
  	  }
! 	folded = build_call_array (currop->type,
! 				   TREE_CODE (declop->op0) == FUNCTION_DECL
! 				   ? build_fold_addr_expr (declop->op0)
! 				   : declop->op0,
! 				   nargs, args);
  	free (args);
  	return folded;
        }
*************** create_component_ref_by_pieces (basic_bl
*** 2585,2592 ****
     on failure.  */

  static tree
! find_or_generate_expression (basic_block block, pre_expr expr, tree stmts,
! 			     tree domstmt)
  {
    pre_expr leader = bitmap_find_leader (AVAIL_OUT (block),
  					get_expr_value_id (expr), domstmt);
--- 2605,2612 ----
     on failure.  */

  static tree
! find_or_generate_expression (basic_block block, pre_expr expr,
! 			     gimple_seq *stmts, gimple domstmt)
  {
    pre_expr leader = bitmap_find_leader (AVAIL_OUT (block),
  					get_expr_value_id (expr), domstmt);
*************** find_or_generate_expression (basic_block
*** 2630,2636 ****
    return genop;
  }

! #define NECESSARY(stmt) stmt->base.asm_written_flag

  /* Create an expression in pieces, so that we can handle very complex
     expressions that may be ANTIC, but not necessary GIMPLE.
--- 2650,2656 ----
    return genop;
  }

! #define NECESSARY GF_PLF_1

  /* Create an expression in pieces, so that we can handle very complex
     expressions that may be ANTIC, but not necessary GIMPLE.
*************** find_or_generate_expression (basic_block
*** 2651,2666 ****
     can return NULL_TREE to signal failure.  */

  static tree
! create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts,
! 			     tree domstmt,
! 			     tree type)
  {
    tree temp, name;
!   tree folded, forced_stmts, newexpr;
    unsigned int value_id;
!   tree_stmt_iterator tsi;
    tree exprtype = type ? type : get_expr_type (expr);
    pre_expr nameexpr;

    switch (expr->kind)
      {
--- 2671,2687 ----
     can return NULL_TREE to signal failure.  */

  static tree
! create_expression_by_pieces (basic_block block, pre_expr expr,
! 			     gimple_seq *stmts, gimple domstmt, tree type)
  {
    tree temp, name;
!   tree folded, newexpr;
!   gimple_seq forced_stmts;
    unsigned int value_id;
!   gimple_stmt_iterator gsi;
    tree exprtype = type ? type : get_expr_type (expr);
    pre_expr nameexpr;
+   gimple newstmt;

    switch (expr->kind)
      {
*************** create_expression_by_pieces (basic_block
*** 2733,2746 ****
       to the value sets and chain them in the instruction stream.  */
    if (forced_stmts)
      {
!       tsi = tsi_start (forced_stmts);
!       for (; !tsi_end_p (tsi); tsi_next (&tsi))
  	{
! 	  tree stmt = tsi_stmt (tsi);
! 	  tree forcedname = GIMPLE_STMT_OPERAND (stmt, 0);
  	  pre_expr nameexpr;

! 	  VEC_safe_push (tree, heap, inserted_exprs, stmt);
  	  if (TREE_CODE (forcedname) == SSA_NAME)
  	    {
  	      VN_INFO_GET (forcedname)->valnum = forcedname;
--- 2754,2767 ----
       to the value sets and chain them in the instruction stream.  */
    if (forced_stmts)
      {
!       gsi = gsi_start (forced_stmts);
!       for (; !gsi_end_p (gsi); gsi_next (&gsi))
  	{
! 	  gimple stmt = gsi_stmt (gsi);
! 	  tree forcedname = gimple_get_lhs (stmt);
  	  pre_expr nameexpr;

! 	  VEC_safe_push (gimple, heap, inserted_exprs, stmt);
  	  if (TREE_CODE (forcedname) == SSA_NAME)
  	    {
  	      VN_INFO_GET (forcedname)->valnum = forcedname;
*************** create_expression_by_pieces (basic_block
*** 2752,2759 ****
  	    }
  	  mark_symbols_for_renaming (stmt);
  	}
!       tsi = tsi_last (stmts);
!       tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING);
      }

    /* Build and insert the assignment of the end result to the temporary
--- 2773,2779 ----
  	    }
  	  mark_symbols_for_renaming (stmt);
  	}
!       gimple_seq_add_seq (stmts, forced_stmts);
      }

    /* Build and insert the assignment of the end result to the temporary
*************** create_expression_by_pieces (basic_block
*** 2771,2787 ****
        || TREE_CODE (exprtype) == VECTOR_TYPE)
      DECL_GIMPLE_REG_P (temp) = 1;

! newexpr = build_gimple_modify_stmt (temp, newexpr);
! name = make_ssa_name (temp, newexpr);
! GIMPLE_STMT_OPERAND (newexpr, 0) = name;
! NECESSARY (newexpr) = 0;
! ! tsi = tsi_last (stmts);
! tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);
! VEC_safe_push (tree, heap, inserted_exprs, newexpr);


    /* All the symbols in NEWEXPR should be put into SSA form.  */
!   mark_symbols_for_renaming (newexpr);

    /* Add a value number to the temporary.
       The value may already exist in either NEW_SETS, or AVAIL_OUT, because
--- 2791,2806 ----
        || TREE_CODE (exprtype) == VECTOR_TYPE)
      DECL_GIMPLE_REG_P (temp) = 1;

! newstmt = gimple_build_assign (temp, newexpr);
! name = make_ssa_name (temp, newstmt);
! gimple_assign_set_lhs (newstmt, name);
! gimple_set_plf (newstmt, NECESSARY, false);
! ! gimple_seq_add_stmt (stmts, newstmt);
! VEC_safe_push (gimple, heap, inserted_exprs, newstmt);


    /* All the symbols in NEWEXPR should be put into SSA form.  */
!   mark_symbols_for_renaming (newstmt);

    /* Add a value number to the temporary.
       The value may already exist in either NEW_SETS, or AVAIL_OUT, because
*************** create_expression_by_pieces (basic_block
*** 2801,2807 ****
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
        fprintf (dump_file, "Inserted ");
!       print_generic_expr (dump_file, newexpr, 0);
        fprintf (dump_file, " in predecessor %d\n", block->index);
      }

--- 2820,2826 ----
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
        fprintf (dump_file, "Inserted ");
!       print_gimple_stmt (dump_file, newstmt, 0, 0);
        fprintf (dump_file, " in predecessor %d\n", block->index);
      }

*************** insert_into_preds_of_block (basic_block
*** 2829,2834 ****
--- 2848,2854 ----
    edge_iterator ei;
    tree type = get_expr_type (expr);
    tree temp;
+   gimple phi;

    if (dump_file && (dump_flags & TDF_DETAILS))
      {
*************** insert_into_preds_of_block (basic_block
*** 2860,2866 ****
    /* Make the necessary insertions.  */
    FOR_EACH_EDGE (pred, ei, block->preds)
      {
!       tree stmts = alloc_stmt_list ();
        tree builtexpr;
        bprime = pred->src;
        eprime = avail[bprime->index];
--- 2880,2886 ----
    /* Make the necessary insertions.  */
    FOR_EACH_EDGE (pred, ei, block->preds)
      {
!       gimple_seq stmts = NULL;
        tree builtexpr;
        bprime = pred->src;
        eprime = avail[bprime->index];
*************** insert_into_preds_of_block (basic_block
*** 2869,2878 ****
  	{
  	  builtexpr = create_expression_by_pieces (bprime,
  						   eprime,
! 						   stmts, NULL_TREE,
  						   type);
  	  gcc_assert (!(pred->flags & EDGE_ABNORMAL));
! 	  bsi_insert_on_edge (pred, stmts);
  	  avail[bprime->index] = get_or_alloc_expr_for_name (builtexpr);
  	  insertions = true;
  	}
--- 2889,2898 ----
  	{
  	  builtexpr = create_expression_by_pieces (bprime,
  						   eprime,
! 						   &stmts, NULL,
  						   type);
  	  gcc_assert (!(pred->flags & EDGE_ABNORMAL));
! 	  gsi_insert_seq_on_edge (pred, stmts);
  	  avail[bprime->index] = get_or_alloc_expr_for_name (builtexpr);
  	  insertions = true;
  	}
*************** insert_into_preds_of_block (basic_block
*** 2907,2924 ****
  			}
  		      if (stmts)
  			{
! 			  tree_stmt_iterator tsi;
! 			  tsi = tsi_start (stmts);
! 			  for (; !tsi_end_p (tsi); tsi_next (&tsi))
  			    {
! 			      tree stmt = tsi_stmt (tsi);
! 			      tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
! 			      VEC_safe_push (tree, heap, inserted_exprs, stmt);
! 			      NECESSARY (lhs) = 0;
  			    }
! 			  bsi_insert_on_edge (pred, stmts);
  			}
! 		      NECESSARY (forcedexpr) = 0;
  		      avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
  		    }
  		}
--- 2927,2944 ----
  			}
  		      if (stmts)
  			{
! 			  gimple_stmt_iterator gsi;
! 			  gsi = gsi_start (stmts);
! 			  for (; !gsi_end_p (gsi); gsi_next (&gsi))
  			    {
! 			      gimple stmt = gsi_stmt (gsi);
! 			      VEC_safe_push (gimple, heap, inserted_exprs, stmt);
! 			      gimple_set_plf (stmt, NECESSARY, false);
  			    }
! 			  gsi_insert_seq_on_edge (pred, stmts);
  			}
! 		      /* FIXME tuples
! 		      gimple_set_plf (forcedexpr, NECESSARY, false); */
  		      avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
  		    }
  		}
*************** insert_into_preds_of_block (basic_block
*** 2955,2972 ****

  	      if (stmts)
  		{
! 		  tree_stmt_iterator tsi;
! 		  tsi = tsi_start (stmts);
! 		  for (; !tsi_end_p (tsi); tsi_next (&tsi))
  		    {
! 		      tree stmt = tsi_stmt (tsi);
! 		      tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
! 		      VEC_safe_push (tree, heap, inserted_exprs, stmt);
! 		      NECESSARY (lhs) = 0;
  		    }
! 		  bsi_insert_on_edge (pred, stmts);
  		}
! 	      NECESSARY (forcedexpr) = 0;
  	      avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
  	    }
  	}
--- 2975,2992 ----

  	      if (stmts)
  		{
! 		  gimple_stmt_iterator gsi;
! 		  gsi = gsi_start (stmts);
! 		  for (; !gsi_end_p (gsi); gsi_next (&gsi))
  		    {
! 		      gimple stmt = gsi_stmt (gsi);
! 		      VEC_safe_push (gimple, heap, inserted_exprs, stmt);
! 		      gimple_set_plf (stmt, NECESSARY, false);
  		    }
! 		  gsi_insert_seq_on_edge (pred, stmts);
  		}
! 	      /* FIXME tuples
! 	      gimple_set_plf (forcedexpr, NECESSARY, false); */
  	      avail[bprime->index] = get_or_alloc_expr_for_name (forcedexpr);
  	    }
  	}
*************** insert_into_preds_of_block (basic_block
*** 2993,3016 ****
    if (TREE_CODE (type) == COMPLEX_TYPE
        || TREE_CODE (type) == VECTOR_TYPE)
      DECL_GIMPLE_REG_P (temp) = 1;
!   temp = create_phi_node (temp, block);

!   NECESSARY (temp) = 0;
!   VN_INFO_GET (PHI_RESULT (temp))->valnum = PHI_RESULT (temp);
!   VN_INFO (PHI_RESULT (temp))->value_id = val;
!   VEC_safe_push (tree, heap, inserted_exprs, temp);
    FOR_EACH_EDGE (pred, ei, block->preds)
      {
        pre_expr ae = avail[pred->src->index];
        gcc_assert (get_expr_type (ae) == type
  		  || useless_type_conversion_p (type, get_expr_type (ae)));
        if (ae->kind == CONSTANT)
! 	add_phi_arg (temp, PRE_EXPR_CONSTANT (ae), pred);
        else
! 	add_phi_arg (temp, PRE_EXPR_NAME (avail[pred->src->index]), pred);
      }

!   newphi = get_or_alloc_expr_for_name (PHI_RESULT (temp));
    add_to_value (val, newphi);

    /* The value should *not* exist in PHI_GEN, or else we wouldn't be doing
--- 3013,3036 ----
    if (TREE_CODE (type) == COMPLEX_TYPE
        || TREE_CODE (type) == VECTOR_TYPE)
      DECL_GIMPLE_REG_P (temp) = 1;
!   phi = create_phi_node (temp, block);

!   gimple_set_plf (phi, NECESSARY, false);
!   VN_INFO_GET (gimple_phi_result (phi))->valnum = gimple_phi_result (phi);
!   VN_INFO (gimple_phi_result (phi))->value_id = val;
!   VEC_safe_push (gimple, heap, inserted_exprs, phi);
    FOR_EACH_EDGE (pred, ei, block->preds)
      {
        pre_expr ae = avail[pred->src->index];
        gcc_assert (get_expr_type (ae) == type
  		  || useless_type_conversion_p (type, get_expr_type (ae)));
        if (ae->kind == CONSTANT)
! 	add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred);
        else
! 	add_phi_arg (phi, PRE_EXPR_NAME (avail[pred->src->index]), pred);
      }

!   newphi = get_or_alloc_expr_for_name (gimple_phi_result (phi));
    add_to_value (val, newphi);

    /* The value should *not* exist in PHI_GEN, or else we wouldn't be doing
*************** insert_into_preds_of_block (basic_block
*** 3036,3042 ****
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
        fprintf (dump_file, "Created phi ");
!       print_generic_expr (dump_file, temp, 0);
        fprintf (dump_file, " in block %d\n", block->index);
      }
    pre_stats.phis++;
--- 3056,3062 ----
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
        fprintf (dump_file, "Created phi ");
!       print_gimple_stmt (dump_file, phi, 0, 0);
        fprintf (dump_file, " in block %d\n", block->index);
      }
    pre_stats.phis++;
*************** do_regular_insertion (basic_block block,
*** 3132,3138 ****
  	      eprime = fully_constant_expression (eprime);
  	      vprime = get_expr_value_id (eprime);
  	      edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
! 						 vprime, NULL_TREE);
  	      if (edoubleprime == NULL)
  		{
  		  avail[bprime->index] = eprime;
--- 3152,3158 ----
  	      eprime = fully_constant_expression (eprime);
  	      vprime = get_expr_value_id (eprime);
  	      edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
! 						 vprime, NULL);
  	      if (edoubleprime == NULL)
  		{
  		  avail[bprime->index] = eprime;
*************** do_partial_partial_insertion (basic_bloc
*** 3266,3272 ****
  	      eprime = fully_constant_expression (eprime);
  	      vprime = get_expr_value_id (eprime);
  	      edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
! 						 vprime, NULL_TREE);
  	      if (edoubleprime == NULL)
  		{
  		  by_all = false;
--- 3286,3292 ----
  	      eprime = fully_constant_expression (eprime);
  	      vprime = get_expr_value_id (eprime);
  	      edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime),
! 						 vprime, NULL);
  	      if (edoubleprime == NULL)
  		{
  		  by_all = false;
*************** add_to_exp_gen (basic_block block, tree
*** 3380,3390 ****
        result = get_or_alloc_expr_for_name (op);
        bitmap_value_insert_into_set (EXP_GEN (block), result);
        if (TREE_CODE (op) != SSA_NAME
! 	  || TREE_CODE (SSA_NAME_DEF_STMT (op)) != PHI_NODE)
  	bitmap_value_insert_into_set (maximal_set, result);
      }
  }

  /* For each real store operation of the form
     *a = <value> that we see, create a corresponding fake store of the
     form storetmp_<version> = *a.
--- 3400,3412 ----
        result = get_or_alloc_expr_for_name (op);
        bitmap_value_insert_into_set (EXP_GEN (block), result);
        if (TREE_CODE (op) != SSA_NAME
! 	  || gimple_code (SSA_NAME_DEF_STMT (op)) != GIMPLE_PHI)
  	bitmap_value_insert_into_set (maximal_set, result);
      }
  }

+ /* FIXME tuples */
+ #if 0
  /* For each real store operation of the form
     *a = <value> that we see, create a corresponding fake store of the
     form storetmp_<version> = *a.
*************** insert_fake_stores (void)
*** 3404,3413 ****

    FOR_ALL_BB (block)
      {
!       block_stmt_iterator bsi;
!       for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
  	{
! 	  tree stmt = bsi_stmt (bsi);

  	  /* We can't generate SSA names for stores that are complex
  	     or aggregate.  We also want to ignore things whose
--- 3426,3435 ----

    FOR_ALL_BB (block)
      {
!       gimple_stmt_iterator gsi;
!       for (gsi = gsi_start_bb (block); !gsi_end_p (gsi); gsi_next (&gsi))
  	{
! 	  gimple stmt = gsi_stmt (gsi);

  	  /* We can't generate SSA names for stores that are complex
  	     or aggregate.  We also want to ignore things whose
*************** insert_fake_stores (void)
*** 3452,3460 ****
  	      GIMPLE_STMT_OPERAND (new_tree, 0) = new_lhs;
  	      create_ssa_artificial_load_stmt (new_tree, stmt, false);

! 	      NECESSARY (new_tree) = 0;
! 	      VEC_safe_push (tree, heap, inserted_exprs, new_tree);
! 	      VEC_safe_push (tree, heap, need_creation, new_tree);
  	      bsi_insert_after (&bsi, new_tree, BSI_NEW_STMT);
  	    }
  	}
--- 3474,3482 ----
  	      GIMPLE_STMT_OPERAND (new_tree, 0) = new_lhs;
  	      create_ssa_artificial_load_stmt (new_tree, stmt, false);

! 	      gimple_set_plf (new_tree, NECESSARY, false);
! 	      VEC_safe_push (gimple, heap, inserted_exprs, new_tree);
! 	      VEC_safe_push (gimple, heap, need_creation, new_tree);
  	      bsi_insert_after (&bsi, new_tree, BSI_NEW_STMT);
  	    }
  	}
*************** realify_fake_stores (void)
*** 3471,3479 ****
    unsigned int i;
    tree stmt;

!   for (i = 0; VEC_iterate (tree, need_creation, i, stmt); i++)
      {
!       if (NECESSARY (stmt))
  	{
  	  block_stmt_iterator bsi, bsi2;
  	  tree rhs;
--- 3493,3501 ----
    unsigned int i;
    tree stmt;

!   for (i = 0; VEC_iterate (gimple, need_creation, i, stmt); i++)
      {
!       if (gimple_plf (stmt, NECESSARY))
  	{
  	  block_stmt_iterator bsi, bsi2;
  	  tree rhs;
*************** realify_fake_stores (void)
*** 3495,3507 ****
  	release_defs (stmt);
      }
  }

/* Create value ids for PHI in BLOCK. */

  static void
! make_values_for_phi (tree phi, basic_block block)
  {
!   tree result = PHI_RESULT (phi);
    /* We have no need for virtual phis, as they don't represent
       actual computations.  */
    if (is_gimple_reg (result))
--- 3517,3531 ----
  	release_defs (stmt);
      }
  }
+ #endif

/* Create value ids for PHI in BLOCK. */

  static void
! make_values_for_phi (gimple phi, basic_block block)
  {
!   tree result = gimple_phi_result (phi);
!
    /* We have no need for virtual phis, as they don't represent
       actual computations.  */
    if (is_gimple_reg (result))
*************** compute_avail (void)
*** 3585,3592 ****
    /* Loop until the worklist is empty.  */
    while (sp)
      {
!       block_stmt_iterator bsi;
!       tree stmt, phi;
        basic_block dom;
        unsigned int stmt_uid = 1;

--- 3609,3616 ----
    /* Loop until the worklist is empty.  */
    while (sp)
      {
!       gimple_stmt_iterator gsi;
!       gimple stmt;
        basic_block dom;
        unsigned int stmt_uid = 1;

*************** compute_avail (void)
*** 3600,3620 ****
  	bitmap_set_copy (AVAIL_OUT (block), AVAIL_OUT (dom));

        /* Generate values for PHI nodes.  */
!       for (phi = phi_nodes (block); phi; phi = PHI_CHAIN (phi))
! 	make_values_for_phi (phi, block);

        /* Now compute value numbers and populate value sets with all
  	 the expressions computed in BLOCK.  */
!       for (bsi = bsi_start (block); !bsi_end_p (bsi); bsi_next (&bsi))
  	{
- 	  stmt_ann_t ann;
  	  ssa_op_iter iter;
  	  tree op;

! stmt = bsi_stmt (bsi);
! ann = stmt_ann (stmt);
! ! set_gimple_stmt_uid (stmt, stmt_uid++);


  	  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
  	    {
--- 3624,3641 ----
  	bitmap_set_copy (AVAIL_OUT (block), AVAIL_OUT (dom));

        /* Generate values for PHI nodes.  */
!       for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
! 	make_values_for_phi (gsi_stmt (gsi), block);

        /* Now compute value numbers and populate value sets with all
  	 the expressions computed in BLOCK.  */
!       for (gsi = gsi_start_bb (block); !gsi_end_p (gsi); gsi_next (&gsi))
  	{
  	  ssa_op_iter iter;
  	  tree op;

! 	  stmt = gsi_stmt (gsi);
! 	  gimple_set_uid (stmt, stmt_uid++);

  	  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
  	    {
*************** compute_avail (void)
*** 3629,3734 ****
  	      bitmap_value_insert_into_set (AVAIL_OUT (block), e);
  	    }

! 	  switch (TREE_CODE (stmt))
  	    {
! 	    case RETURN_EXPR:
! 	      if (!ann->has_volatile_ops)
! 		FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
! 		  add_to_exp_gen (block, op);
  	      continue;
! 	    case GIMPLE_MODIFY_STMT:
  	      {
! 		tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
! 		if (!ann->has_volatile_ops
! 		    && !tree_could_throw_p (stmt))
! 		  {
! 		    pre_expr result = NULL;
! 		    switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
! 		      {
! 		      case tcc_unary:
! 			if (is_exception_related (rhs))
! 			  continue;
! 		      case tcc_binary:
! 			{
! 			  vn_nary_op_t nary;
! 			  unsigned int i;

! vn_nary_op_lookup (rhs, &nary);

! 			  if (!nary)
! 			    continue;

! for (i = 0; i < nary->length; i++)
! if (TREE_CODE (nary->op[i]) == SSA_NAME)
! add_to_exp_gen (block, nary->op[i]);
! ! result = (pre_expr) pool_alloc (pre_expr_pool);
! result->kind = NARY;
! result->id = 0;
! PRE_EXPR_NARY (result) = nary;
! }
! break;
! case tcc_vl_exp:
! if (!can_value_number_call (rhs))
! continue;


! case tcc_declaration:
! case tcc_reference:
! {
! vn_reference_t ref;
! unsigned int i;
! vn_reference_op_t vro;
! ! vn_reference_lookup (rhs,
! shared_vuses_from_stmt (stmt),
! true, &ref);
! if (!ref)
! continue;
! ! for (i = 0; VEC_iterate (vn_reference_op_s,
! ref->operands, i,
! vro); i++)
! {
! if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)
! add_to_exp_gen (block, vro->op0);
! if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
! add_to_exp_gen (block, vro->op1);
! }
! result = (pre_expr) pool_alloc (pre_expr_pool);
! result->kind = REFERENCE;
! result->id = 0;
! PRE_EXPR_REFERENCE (result) = ref;
! }
! break;
! default:
{
! /* For any other statement that we don't
! recognize, simply add all referenced
! SSA_NAMEs to EXP_GEN. */
! FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
! add_to_exp_gen (block, op);
! continue;
}
! }
! get_or_alloc_expression_id (result);
! add_to_value (get_expr_value_id (result), result);
! if (!in_fre)
! {
! bitmap_value_insert_into_set (EXP_GEN (block),
! result);
! bitmap_value_insert_into_set (maximal_set, result);
! }


}
continue;
}
default:
break;
-
}
- -
}
/* Put the dominator children of BLOCK on the worklist of blocks
to compute available sets for. */
for (son = first_dom_son (CDI_DOMINATORS, block);
--- 3650,3796 ----
bitmap_value_insert_into_set (AVAIL_OUT (block), e);
}


! if (gimple_has_volatile_ops (stmt)
! || stmt_could_throw_p (stmt))
! continue;
! ! switch (gimple_code (stmt))
{
! case GIMPLE_RETURN:
! FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
! add_to_exp_gen (block, op);
continue;
! ! case GIMPLE_CALL:
{
! vn_reference_t ref;
! unsigned int i;
! vn_reference_op_t vro;
! pre_expr result = NULL;
! VEC(vn_reference_op_s, heap) *ops = NULL;


! 		if (!can_value_number_call (stmt))
! 		  continue;

! 		copy_reference_ops_from_call (stmt, &ops);
! 		vn_reference_lookup_pieces (shared_vuses_from_stmt (stmt),
! 					    ops, &ref);
! 		VEC_free (vn_reference_op_s, heap, ops);
! 		if (!ref)
! 		  continue;

! for (i = 0; VEC_iterate (vn_reference_op_s,
! ref->operands, i,
! vro); i++)
! {
! if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)
! add_to_exp_gen (block, vro->op0);
! if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
! add_to_exp_gen (block, vro->op1);
! }
! result = (pre_expr) pool_alloc (pre_expr_pool);
! result->kind = REFERENCE;
! result->id = 0;
! PRE_EXPR_REFERENCE (result) = ref;
! ! get_or_alloc_expression_id (result);
! add_to_value (get_expr_value_id (result), result);
! if (!in_fre)
! {
! bitmap_value_insert_into_set (EXP_GEN (block),
! result);
! bitmap_value_insert_into_set (maximal_set, result);
! }
! continue;
! }


! case GIMPLE_ASSIGN:
! {
! pre_expr result = NULL;
! switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
! {
! case tcc_unary:
! if (is_exception_related (stmt))
! continue;
! case tcc_binary:
! {
! vn_nary_op_t nary;
! unsigned int i;
! ! vn_nary_op_lookup_pieces (gimple_num_ops (stmt) - 1,
! gimple_assign_rhs_code (stmt),
! gimple_expr_type (stmt),
! gimple_assign_rhs1 (stmt),
! gimple_assign_rhs2 (stmt),
! NULL_TREE, NULL_TREE, &nary);
! ! if (!nary)
! continue;
! ! for (i = 0; i < nary->length; i++)
! if (TREE_CODE (nary->op[i]) == SSA_NAME)
! add_to_exp_gen (block, nary->op[i]);
! ! result = (pre_expr) pool_alloc (pre_expr_pool);
! result->kind = NARY;
! result->id = 0;
! PRE_EXPR_NARY (result) = nary;
! break;
! }
! ! case tcc_declaration:
! case tcc_reference:
! {
! vn_reference_t ref;
! unsigned int i;
! vn_reference_op_t vro;
! ! vn_reference_lookup (gimple_assign_rhs1 (stmt),
! shared_vuses_from_stmt (stmt),
! true, &ref);
! if (!ref)
! continue;
! ! for (i = 0; VEC_iterate (vn_reference_op_s,
! ref->operands, i,
! vro); i++)
{
! if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)
! add_to_exp_gen (block, vro->op0);
! if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
! add_to_exp_gen (block, vro->op1);
}
! result = (pre_expr) pool_alloc (pre_expr_pool);
! result->kind = REFERENCE;
! result->id = 0;
! PRE_EXPR_REFERENCE (result) = ref;
! break;
! }


+ default:
+ /* For any other statement that we don't
+ recognize, simply add all referenced
+ SSA_NAMEs to EXP_GEN. */
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
+ add_to_exp_gen (block, op);
+ continue;
}
+ + get_or_alloc_expression_id (result);
+ add_to_value (get_expr_value_id (result), result);
+ if (!in_fre)
+ {
+ bitmap_value_insert_into_set (EXP_GEN (block), result);
+ bitmap_value_insert_into_set (maximal_set, result);
+ }
+
continue;
}
default:
break;
}
}
+
/* Put the dominator children of BLOCK on the worklist of blocks
to compute available sets for. */
for (son = first_dom_son (CDI_DOMINATORS, block);
*************** static tree
*** 3749,3756 ****
do_SCCVN_insertion (gimple stmt, tree ssa_vn)
{
basic_block bb = gimple_bb (stmt);
! block_stmt_iterator bsi;
! tree expr, stmts;
pre_expr e;


    /* First create a value expression from the expression we want
--- 3811,3819 ----
  do_SCCVN_insertion (gimple stmt, tree ssa_vn)
  {
    basic_block bb = gimple_bb (stmt);
!   gimple_stmt_iterator gsi;
!   gimple_seq stmts = NULL;
!   tree expr;
    pre_expr e;

    /* First create a value expression from the expression we want
*************** do_SCCVN_insertion (gimple stmt, tree ss
*** 3761,3775 ****
    if (e == NULL)
      return NULL_TREE;

! /* Then use create_expression_by_pieces to generate a valid
       expression to insert at this point of the IL stream.  */
!   stmts = alloc_stmt_list ();
!   expr = create_expression_by_pieces (bb, e, stmts, stmt,
! 				      NULL);
    if (expr == NULL_TREE)
      return NULL_TREE;
!   bsi = bsi_for_stmt (stmt);
!   bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);

    return expr;
  }
--- 3824,3836 ----
    if (e == NULL)
      return NULL_TREE;

!   /* Then use create_expression_by_pieces to generate a valid
       expression to insert at this point of the IL stream.  */
!   expr = create_expression_by_pieces (bb, e, &stmts, stmt, NULL);
    if (expr == NULL_TREE)
      return NULL_TREE;
!   gsi = gsi_for_stmt (stmt);
!   gsi_insert_seq_before (&gsi, stmts, GSI_SAME_STMT);

    return expr;
  }
*************** eliminate (void)
*** 3784,3813 ****

    FOR_EACH_BB (b)
      {
!       block_stmt_iterator i;

!       for (i = bsi_start (b); !bsi_end_p (i); bsi_next (&i))
  	{
! 	  tree stmt = bsi_stmt (i);

  	  /* Lookup the RHS of the expression, see if we have an
  	     available computation for it.  If so, replace the RHS with
  	     the available computation.  */
! 	  if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
! 	      && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
! 	      && TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) != SSA_NAME
! 	      && !is_gimple_min_invariant (GIMPLE_STMT_OPERAND (stmt, 1))
! 	      && !stmt_ann (stmt)->has_volatile_ops)
  	    {
! 	      tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
! 	      tree *rhs_p = &GIMPLE_STMT_OPERAND (stmt, 1);
  	      tree sprime = NULL;
  	      pre_expr lhsexpr = get_or_alloc_expr_for_name (lhs);
  	      pre_expr sprimeexpr;

  	      sprimeexpr = bitmap_find_leader (AVAIL_OUT (b),
  					       get_expr_value_id (lhsexpr),
! 					       NULL_TREE);

  	      if (sprimeexpr)
  		{
--- 3845,3878 ----

    FOR_EACH_BB (b)
      {
!       gimple_stmt_iterator i;

!       for (i = gsi_start_bb (b); !gsi_end_p (i); gsi_next (&i))
  	{
! 	  gimple stmt = gsi_stmt (i);

  	  /* Lookup the RHS of the expression, see if we have an
  	     available computation for it.  If so, replace the RHS with
  	     the available computation.  */
! 	  if (gimple_has_lhs (stmt)
! 	      && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME
! 	      && !gimple_assign_ssa_name_copy_p (stmt)
! 	      && (!gimple_assign_single_p (stmt)
! 		  || !is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
! 	      && !gimple_has_volatile_ops  (stmt))
  	    {
! 	      tree lhs = gimple_get_lhs (stmt);
! 	      tree rhs = NULL_TREE;
  	      tree sprime = NULL;
  	      pre_expr lhsexpr = get_or_alloc_expr_for_name (lhs);
  	      pre_expr sprimeexpr;

+ 	      if (gimple_assign_single_p (stmt))
+ 		rhs = gimple_assign_rhs1 (stmt);
+
  	      sprimeexpr = bitmap_find_leader (AVAIL_OUT (b),
  					       get_expr_value_id (lhsexpr),
! 					       NULL);

  	      if (sprimeexpr)
  		{
*************** eliminate (void)
*** 3827,3840 ****
  		  if (dump_file && (dump_flags & TDF_DETAILS))
  		    {
  		      fprintf (dump_file, "Replaced ");
! 		      print_generic_expr (dump_file, *rhs_p, 0);
  		      fprintf (dump_file, " with ");
  		      print_generic_expr (dump_file, sprime, 0);
  		      fprintf (dump_file, " in ");
! 		      print_generic_stmt (dump_file, stmt, 0);
  		    }
  		  pre_stats.eliminations++;
! 		  propagate_tree_value (rhs_p, sprime);
  		  update_stmt (stmt);
  		  continue;
  		}
--- 3892,3906 ----
  		  if (dump_file && (dump_flags & TDF_DETAILS))
  		    {
  		      fprintf (dump_file, "Replaced ");
! 		      print_gimple_stmt (dump_file, stmt, 0, TDF_RHS_ONLY);
  		      fprintf (dump_file, " with ");
  		      print_generic_expr (dump_file, sprime, 0);
  		      fprintf (dump_file, " in ");
! 		      print_gimple_stmt (dump_file, stmt, 0, 0);
  		    }
  		  pre_stats.eliminations++;
! 		  propagate_tree_value_into_stmt (&i, sprime);
! 		  stmt = gsi_stmt (i);
  		  update_stmt (stmt);
  		  continue;
  		}
*************** eliminate (void)
*** 3853,3885 ****
  		}
  	      if (sprime
  		  && sprime != lhs
! 		  && (TREE_CODE (*rhs_p) != SSA_NAME
! 		      || may_propagate_copy (*rhs_p, sprime)))
  		{
! 		  gcc_assert (sprime != *rhs_p);

  		  if (dump_file && (dump_flags & TDF_DETAILS))
  		    {
  		      fprintf (dump_file, "Replaced ");
! 		      print_generic_expr (dump_file, *rhs_p, 0);
  		      fprintf (dump_file, " with ");
  		      print_generic_expr (dump_file, sprime, 0);
  		      fprintf (dump_file, " in ");
! 		      print_generic_stmt (dump_file, stmt, 0);
  		    }

  		  if (TREE_CODE (sprime) == SSA_NAME)
! 		    NECESSARY (SSA_NAME_DEF_STMT (sprime)) = 1;
  		  /* We need to make sure the new and old types actually match,
  		     which may require adding a simple cast, which fold_convert
  		     will do for us.  */
! 		  if (TREE_CODE (*rhs_p) != SSA_NAME
! 		      && !useless_type_conversion_p (TREE_TYPE (*rhs_p),
! 						    TREE_TYPE (sprime)))
! 		    sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);

  		  pre_stats.eliminations++;
! 		  propagate_tree_value (rhs_p, sprime);
  		  update_stmt (stmt);

  		  /* If we removed EH side effects from the statement, clean
--- 3919,3954 ----
  		}
  	      if (sprime
  		  && sprime != lhs
! 		  && (rhs == NULL_TREE
! 		      || TREE_CODE (rhs) != SSA_NAME
! 		      || may_propagate_copy (rhs, sprime)))
  		{
! 		  gcc_assert (sprime != rhs);

  		  if (dump_file && (dump_flags & TDF_DETAILS))
  		    {
  		      fprintf (dump_file, "Replaced ");
! 		      print_gimple_stmt (dump_file, stmt, 0, TDF_RHS_ONLY);
  		      fprintf (dump_file, " with ");
  		      print_generic_expr (dump_file, sprime, 0);
  		      fprintf (dump_file, " in ");
! 		      print_gimple_stmt (dump_file, stmt, 0, 0);
  		    }

  		  if (TREE_CODE (sprime) == SSA_NAME)
! 		    gimple_set_plf (SSA_NAME_DEF_STMT (sprime),
! 				    NECESSARY, true);
  		  /* We need to make sure the new and old types actually match,
  		     which may require adding a simple cast, which fold_convert
  		     will do for us.  */
! 		  if ((!rhs || TREE_CODE (rhs) != SSA_NAME)
! 		      && !useless_type_conversion_p (gimple_expr_type (stmt),
! 						     TREE_TYPE (sprime)))
! 		    sprime = fold_convert (gimple_expr_type (stmt), sprime);

  		  pre_stats.eliminations++;
! 		  propagate_tree_value_into_stmt (&i, sprime);
! 		  stmt = gsi_stmt (i);
  		  update_stmt (stmt);

  		  /* If we removed EH side effects from the statement, clean
*************** eliminate (void)
*** 3895,3930 ****
  	    }
  	  /* Visit COND_EXPRs and fold the comparison with the
  	     available value-numbers.  */
! 	  else if (TREE_CODE (stmt) == COND_EXPR
! 		   && COMPARISON_CLASS_P (COND_EXPR_COND (stmt)))
  	    {
! 	      tree cond = COND_EXPR_COND (stmt);
! 	      tree op0 = TREE_OPERAND (cond, 0);
! 	      tree op1 = TREE_OPERAND (cond, 1);
  	      tree result;

  	      if (TREE_CODE (op0) == SSA_NAME)
  		op0 = VN_INFO (op0)->valnum;
  	      if (TREE_CODE (op1) == SSA_NAME)
  		op1 = VN_INFO (op1)->valnum;
! 	      result = fold_binary (TREE_CODE (cond), TREE_TYPE (cond),
  				    op0, op1);
  	      if (result && TREE_CODE (result) == INTEGER_CST)
  		{
! 		  COND_EXPR_COND (stmt) = result;
! 		  update_stmt (stmt);
! 		  todo = TODO_cleanup_cfg;
! 		}
! 	    }
! 	  else if (TREE_CODE (stmt) == COND_EXPR
! 		   && TREE_CODE (COND_EXPR_COND (stmt)) == SSA_NAME)
! 	    {
! 	      tree op = COND_EXPR_COND (stmt);
! 	      op = VN_INFO (op)->valnum;
! 	      if (TREE_CODE (op) == INTEGER_CST)
! 		{
! 		  COND_EXPR_COND (stmt) = integer_zerop (op)
! 		    ? boolean_false_node : boolean_true_node;
  		  update_stmt (stmt);
  		  todo = TODO_cleanup_cfg;
  		}
--- 3964,3987 ----
  	    }
  	  /* Visit COND_EXPRs and fold the comparison with the
  	     available value-numbers.  */
! 	  else if (gimple_code (stmt) == GIMPLE_COND)
  	    {
! 	      tree op0 = gimple_cond_lhs (stmt);
! 	      tree op1 = gimple_cond_rhs (stmt);
  	      tree result;

  	      if (TREE_CODE (op0) == SSA_NAME)
  		op0 = VN_INFO (op0)->valnum;
  	      if (TREE_CODE (op1) == SSA_NAME)
  		op1 = VN_INFO (op1)->valnum;
! 	      result = fold_binary (gimple_cond_code (stmt), boolean_type_node,
  				    op0, op1);
  	      if (result && TREE_CODE (result) == INTEGER_CST)
  		{
! 		  if (integer_zerop (result))
! 		    gimple_cond_make_false (stmt);
! 		  else
! 		    gimple_cond_make_true (stmt);
  		  update_stmt (stmt);
  		  todo = TODO_cleanup_cfg;
  		}
*************** eliminate (void)
*** 3943,3952 ****
     mark that statement necessary. Return the stmt, if it is newly
     necessary.  */

! static inline tree
  mark_operand_necessary (tree op)
  {
!   tree stmt;

gcc_assert (op);

--- 4000,4009 ----
     mark that statement necessary. Return the stmt, if it is newly
     necessary.  */

! static inline gimple
  mark_operand_necessary (tree op)
  {
!   gimple stmt;

gcc_assert (op);

*************** mark_operand_necessary (tree op)
*** 3956,3966 ****
    stmt = SSA_NAME_DEF_STMT (op);
    gcc_assert (stmt);

!   if (NECESSARY (stmt)
!       || IS_EMPTY_STMT (stmt))
      return NULL;

!   NECESSARY (stmt) = 1;
    return stmt;
  }

--- 4013,4023 ----
    stmt = SSA_NAME_DEF_STMT (op);
    gcc_assert (stmt);

!   if (gimple_plf (stmt, NECESSARY)
!       || gimple_nop_p (stmt))
      return NULL;

!   gimple_set_plf (stmt, NECESSARY, true);
    return stmt;
  }

*************** mark_operand_necessary (tree op)
*** 3972,4007 ****
  static void
  remove_dead_inserted_code (void)
  {
!   VEC(tree,heap) *worklist = NULL;
    int i;
!   tree t;

!   worklist = VEC_alloc (tree, heap, VEC_length (tree, inserted_exprs));
!   for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
      {
!       if (NECESSARY (t))
! 	VEC_quick_push (tree, worklist, t);
      }
!   while (VEC_length (tree, worklist) > 0)
      {
!       t = VEC_pop (tree, worklist);

        /* PHI nodes are somewhat special in that each PHI alternative has
  	 data and control dependencies.  All the statements feeding the
  	 PHI node's arguments are always necessary. */
!       if (TREE_CODE (t) == PHI_NODE)
  	{
! 	  int k;

! 	  VEC_reserve (tree, heap, worklist, PHI_NUM_ARGS (t));
! 	  for (k = 0; k < PHI_NUM_ARGS (t); k++)
  	    {
  	      tree arg = PHI_ARG_DEF (t, k);
  	      if (TREE_CODE (arg) == SSA_NAME)
  		{
! 		  arg = mark_operand_necessary (arg);
! 		  if (arg)
! 		    VEC_quick_push (tree, worklist, arg);
  		}
  	    }
  	}
--- 4029,4064 ----
  static void
  remove_dead_inserted_code (void)
  {
!   VEC(gimple,heap) *worklist = NULL;
    int i;
!   gimple t;

!   worklist = VEC_alloc (gimple, heap, VEC_length (gimple, inserted_exprs));
!   for (i = 0; VEC_iterate (gimple, inserted_exprs, i, t); i++)
      {
!       if (gimple_plf (t, NECESSARY))
! 	VEC_quick_push (gimple, worklist, t);
      }
!   while (VEC_length (gimple, worklist) > 0)
      {
!       t = VEC_pop (gimple, worklist);

        /* PHI nodes are somewhat special in that each PHI alternative has
  	 data and control dependencies.  All the statements feeding the
  	 PHI node's arguments are always necessary. */
!       if (gimple_code (t) == GIMPLE_PHI)
  	{
! 	  unsigned k;

! 	  VEC_reserve (gimple, heap, worklist, gimple_phi_num_args (t));
! 	  for (k = 0; k < gimple_phi_num_args (t); k++)
  	    {
  	      tree arg = PHI_ARG_DEF (t, k);
  	      if (TREE_CODE (arg) == SSA_NAME)
  		{
! 		  gimple n = mark_operand_necessary (arg);
! 		  if (n)
! 		    VEC_quick_push (gimple, worklist, n);
  		}
  	    }
  	}
*************** remove_dead_inserted_code (void)
*** 4020,4057 ****

  	  FOR_EACH_SSA_TREE_OPERAND (use, t, iter, SSA_OP_ALL_USES)
  	    {
! 	      tree n = mark_operand_necessary (use);
  	      if (n)
! 		VEC_safe_push (tree, heap, worklist, n);
  	    }
  	}
      }

!   for (i = 0; VEC_iterate (tree, inserted_exprs, i, t); i++)
      {
!       if (!NECESSARY (t))
  	{
! 	  block_stmt_iterator bsi;

  	  if (dump_file && (dump_flags & TDF_DETAILS))
  	    {
  	      fprintf (dump_file, "Removing unnecessary insertion:");
! 	      print_generic_stmt (dump_file, t, 0);
  	    }

! 	  if (TREE_CODE (t) == PHI_NODE)
! 	    {
! 	      remove_phi_node (t, NULL_TREE, true);
! 	    }
  	  else
! 	    {
! 	      bsi = bsi_for_stmt (t);
! 	      bsi_remove (&bsi, true);
! 	      release_defs (t);
! 	    }
  	}
      }
!   VEC_free (tree, heap, worklist);
  }

  /* Initialize data structures used by PRE.  */
--- 4077,4110 ----

  	  FOR_EACH_SSA_TREE_OPERAND (use, t, iter, SSA_OP_ALL_USES)
  	    {
! 	      gimple n = mark_operand_necessary (use);
  	      if (n)
! 		VEC_safe_push (gimple, heap, worklist, n);
  	    }
  	}
      }

!   for (i = 0; VEC_iterate (gimple, inserted_exprs, i, t); i++)
      {
!       if (!gimple_plf (t, NECESSARY))
  	{
! 	  gimple_stmt_iterator gsi;

  	  if (dump_file && (dump_flags & TDF_DETAILS))
  	    {
  	      fprintf (dump_file, "Removing unnecessary insertion:");
! 	      print_gimple_stmt (dump_file, t, 0, 0);
  	    }

! 	  gsi = gsi_for_stmt (t);
! 	  if (gimple_code (t) == GIMPLE_PHI)
! 	    remove_phi_node (&gsi, true);
  	  else
! 	    gsi_remove (&gsi, true);
! 	  release_defs (t);
  	}
      }
!   VEC_free (gimple, heap, worklist);
  }

  /* Initialize data structures used by PRE.  */
*************** fini_pre (void)
*** 4122,4129 ****

    free (postorder);
    VEC_free (bitmap_set_t, heap, value_expressions);
!   VEC_free (tree, heap, inserted_exprs);
!   VEC_free (tree, heap, need_creation);
    bitmap_obstack_release (&grand_bitmap_obstack);
    free_alloc_pool (bitmap_set_pool);
    free_alloc_pool (pre_expr_pool);
--- 4175,4182 ----

    free (postorder);
    VEC_free (bitmap_set_t, heap, value_expressions);
!   VEC_free (gimple, heap, inserted_exprs);
!   VEC_free (gimple, heap, need_creation);
    bitmap_obstack_release (&grand_bitmap_obstack);
    free_alloc_pool (bitmap_set_pool);
    free_alloc_pool (pre_expr_pool);
*************** fini_pre (void)
*** 4141,4147 ****

    if (!bitmap_empty_p (need_eh_cleanup))
      {
!       tree_purge_all_dead_eh_edges (need_eh_cleanup);
        cleanup_tree_cfg ();
      }

--- 4194,4200 ----

    if (!bitmap_empty_p (need_eh_cleanup))
      {
!       gimple_purge_all_dead_eh_edges (need_eh_cleanup);
        cleanup_tree_cfg ();
      }

*************** fini_pre (void)
*** 4150,4156 ****
    if (current_loops != NULL)
      loop_optimizer_finalize ();
  }
- #endif

/* Main entry point to the SSA-PRE pass. DO_FRE is true if the caller
only wants to do full redundancy elimination. */
--- 4203,4208 ----
*************** fini_pre (void)
*** 4158,4169 ****
static unsigned int
execute_pre (bool do_fre ATTRIBUTE_UNUSED)
{
- /* FIXME tuples. */
- if (run_scc_vn (do_fre))
- free_scc_vn ();
- - /* FIXME tuples. */
- #if 0
unsigned int todo = 0;


    do_partial_partial = optimize > 2;
--- 4210,4215 ----
*************** execute_pre (bool do_fre ATTRIBUTE_UNUSE
*** 4172,4179 ****
--- 4218,4228 ----
       loop_optimizer_init may create new phis, etc.  */
    if (!do_fre)
      loop_optimizer_init (LOOPS_NORMAL);
+   /* FIXME tuples */
+ #if 0
    if (0 && !do_fre)
      insert_fake_stores ();
+ #endif

    if (!run_scc_vn (do_fre))
      {
*************** execute_pre (bool do_fre ATTRIBUTE_UNUSE
*** 4220,4241 ****
    statistics_counter_event (cfun, "New PHIs", pre_stats.phis);
    statistics_counter_event (cfun, "Eliminated", pre_stats.eliminations);
    statistics_counter_event (cfun, "Constified", pre_stats.constified);
!   bsi_commit_edge_inserts ();

    clear_expression_ids ();
    free_scc_vn ();
    if (!do_fre)
      {
        remove_dead_inserted_code ();
        if (0)
  	realify_fake_stores ();
      }

fini_pre ();

    return todo;
- #endif
-   return 0;
  }

  /* Gate and execute functions for PRE.  */
--- 4269,4291 ----
    statistics_counter_event (cfun, "New PHIs", pre_stats.phis);
    statistics_counter_event (cfun, "Eliminated", pre_stats.eliminations);
    statistics_counter_event (cfun, "Constified", pre_stats.constified);
!   gsi_commit_edge_inserts ();

    clear_expression_ids ();
    free_scc_vn ();
    if (!do_fre)
      {
        remove_dead_inserted_code ();
+   /* FIXME tuples */
+ #if 0
        if (0)
  	realify_fake_stores ();
+ #endif
      }

fini_pre ();

    return todo;
  }

  /* Gate and execute functions for PRE.  */
Index: gimple-tuples-branch/gcc/tree-ssa-sccvn.c
===================================================================
*** gimple-tuples-branch.orig/gcc/tree-ssa-sccvn.c	2008-07-09 13:47:39.000000000 +0200
--- gimple-tuples-branch/gcc/tree-ssa-sccvn.c	2008-07-09 18:35:25.000000000 +0200
*************** vn_get_expr_for (tree name)
*** 223,229 ****
  {
    vn_ssa_aux_t vn = VN_INFO (name);
    gimple def_stmt;
!   tree expr;

    if (vn->valnum == VN_TOP)
      return name;
--- 223,229 ----
  {
    vn_ssa_aux_t vn = VN_INFO (name);
    gimple def_stmt;
!   tree expr = NULL_TREE;

    if (vn->valnum == VN_TOP)
      return name;
*************** vn_get_expr_for (tree name)
*** 248,260 ****
    /* Otherwise use the defining statement to build the expression.  */
    def_stmt = SSA_NAME_DEF_STMT (vn->valnum);

!   /* If the value number is a default-definition use it directly.  */
!   if (gimple_nop_p (def_stmt))
      return vn->valnum;

!   /* ???  This will return NULL_TREE if the stmt cannot be simplified.  */
!   expr = gimple_fold (def_stmt);
!   if (!expr)
      return vn->valnum;

    /* Cache the expression.  */
--- 248,288 ----
    /* Otherwise use the defining statement to build the expression.  */
    def_stmt = SSA_NAME_DEF_STMT (vn->valnum);

!   /* If the value number is a default-definition or a PHI result
!      use it directly.  */
!   if (gimple_nop_p (def_stmt)
!       || gimple_code (def_stmt) == GIMPLE_PHI)
      return vn->valnum;

! if (!is_gimple_assign (def_stmt))
! return vn->valnum;
! ! /* FIXME tuples. This is incomplete and likely will miss some
! simplifications. */
! switch (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)))
! {
! case tcc_reference:
! if (gimple_assign_rhs_code (def_stmt) != VIEW_CONVERT_EXPR
! && gimple_assign_rhs_code (def_stmt) != REALPART_EXPR
! && gimple_assign_rhs_code (def_stmt) != IMAGPART_EXPR)
! break;
! /* Fallthrough. */
! case tcc_unary:
! expr = fold_build1 (gimple_assign_rhs_code (def_stmt),
! gimple_expr_type (def_stmt),
! gimple_assign_rhs1 (def_stmt));
! break;
! ! case tcc_binary:
! expr = fold_build2 (gimple_assign_rhs_code (def_stmt),
! gimple_expr_type (def_stmt),
! gimple_assign_rhs1 (def_stmt),
! gimple_assign_rhs2 (def_stmt));
! break;
! ! default:;
! }
! if (expr == NULL_TREE)
return vn->valnum;


    /* Cache the expression.  */
*************** copy_reference_ops_from_ref (tree ref, V
*** 627,633 ****
  /* Copy the operations present in load/store/call REF into RESULT, a vector of
     vn_reference_op_s's.  */

! static void
  copy_reference_ops_from_call (gimple call,
  			      VEC(vn_reference_op_s, heap) **result)
  {
--- 655,661 ----
  /* Copy the operations present in load/store/call REF into RESULT, a vector of
     vn_reference_op_s's.  */

! void
  copy_reference_ops_from_call (gimple call,
  			      VEC(vn_reference_op_s, heap) **result)
  {
*************** set_ssa_val_to (tree from, tree to)
*** 1430,1435 ****
--- 1458,1464 ----
    if (currval != to  && !operand_equal_p (currval, to, OEP_PURE_SAME))
      {
        SSA_VAL (from) = to;
+       VN_INFO (from)->expr = NULL_TREE;
        return true;
      }
    return false;
*************** visit_reference_op_load (tree lhs, tree
*** 1601,1606 ****
--- 1630,1636 ----
  	  result = make_ssa_name (SSA_NAME_VAR (lhs), NULL);
  	  /* Initialize value-number information properly.  */
  	  VN_INFO_GET (result)->valnum = result;
+ 	  VN_INFO (result)->value_id = get_next_value_id ();
  	  VN_INFO (result)->expr = val;
  	  VN_INFO (result)->has_constants = expr_has_constants (val);
  	  VN_INFO (result)->needs_insertion = true;
*************** simplify_binary_expression (gimple stmt)
*** 1949,1962 ****
    result = fold_binary (gimple_assign_rhs_code (stmt),
  			TREE_TYPE (gimple_get_lhs (stmt)), op0, op1);

!   fold_undefer_overflow_warnings (result && valid_gimple_expression_p (result),
  				  stmt, 0);

    /* Make sure result is not a complex expression consisting
       of operators of operators (IE (a + b) + (a + c))
       Otherwise, we will end up with unbounded expressions if
       fold does anything at all.  */
!   if (result && valid_gimple_expression_p (result))
      return result;

    return NULL_TREE;
--- 1979,1992 ----
    result = fold_binary (gimple_assign_rhs_code (stmt),
  			TREE_TYPE (gimple_get_lhs (stmt)), op0, op1);

!   fold_undefer_overflow_warnings (result && valid_gimple_rhs_p (result),
  				  stmt, 0);

    /* Make sure result is not a complex expression consisting
       of operators of operators (IE (a + b) + (a + c))
       Otherwise, we will end up with unbounded expressions if
       fold does anything at all.  */
!   if (result && valid_gimple_rhs_p (result))
      return result;

    return NULL_TREE;
*************** simplify_unary_expression (gimple stmt)
*** 1997,2007 ****
      return NULL_TREE;

    result = fold_unary (gimple_assign_rhs_code (stmt),
! 		       TREE_TYPE (gimple_get_lhs (stmt)), op0);
    if (result)
      {
        STRIP_USELESS_TYPE_CONVERSION (result);
!       if (valid_gimple_expression_p (result))
          return result;
      }

--- 2027,2037 ----
      return NULL_TREE;

    result = fold_unary (gimple_assign_rhs_code (stmt),
! 		       gimple_expr_type (stmt), op0);
    if (result)
      {
        STRIP_USELESS_TYPE_CONVERSION (result);
!       if (valid_gimple_rhs_p (result))
          return result;
      }

*************** visit_use (tree use)
*** 2110,2117 ****
  	    {
  	      if (dump_file && (dump_flags & TDF_DETAILS))
  		{
! 		  fprintf (dump_file, "RHS of ");
! 		  print_gimple_stmt (dump_file, stmt, 0, 0);
  		  fprintf (dump_file, " simplified to ");
  		  print_generic_expr (dump_file, simplified, 0);
  		  if (TREE_CODE (lhs) == SSA_NAME)
--- 2140,2147 ----
  	    {
  	      if (dump_file && (dump_flags & TDF_DETAILS))
  		{
! 		  fprintf (dump_file, "RHS ");
! 		  print_gimple_stmt (dump_file, stmt, 0, TDF_RHS_ONLY);
  		  fprintf (dump_file, " simplified to ");
  		  print_generic_expr (dump_file, simplified, 0);
  		  if (TREE_CODE (lhs) == SSA_NAME)
Index: gimple-tuples-branch/gcc/tree-ssa-sccvn.h
===================================================================
*** gimple-tuples-branch.orig/gcc/tree-ssa-sccvn.h	2008-07-09 13:47:39.000000000 +0200
--- gimple-tuples-branch/gcc/tree-ssa-sccvn.h	2008-07-09 13:47:49.000000000 +0200
*************** vn_nary_op_t vn_nary_op_insert_stmt (gim
*** 152,157 ****
--- 152,158 ----
  vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code,
  				       tree, tree, tree, tree,
  				       tree, tree, unsigned int);
+ void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **);
  tree vn_reference_lookup_pieces (VEC (tree, gc) *,
  				 VEC (vn_reference_op_s, heap) *,
  				 vn_reference_t *);
Index: gimple-tuples-branch/gcc/tree-ssa-copy.c
===================================================================
*** gimple-tuples-branch.orig/gcc/tree-ssa-copy.c	2008-06-10 17:17:07.000000000 +0200
--- gimple-tuples-branch/gcc/tree-ssa-copy.c	2008-07-09 15:35:11.000000000 +0200
*************** propagate_tree_value_into_stmt (gimple_s
*** 467,473 ****
        new_stmt  = gimple_build_assign (gimple_call_lhs (stmt), expr);
        copy_virtual_operands (new_stmt, stmt);
        move_ssa_defining_stmt_for_defs (new_stmt, stmt);
-       gimple_set_location (new_stmt, gimple_location (stmt));
        gsi_replace (gsi, new_stmt, false);
      }
    else if (gimple_code (stmt) == GIMPLE_SWITCH)
--- 467,472 ----
Index: gimple-tuples-branch/gcc/gimple-pretty-print.c
===================================================================
*** gimple-tuples-branch.orig/gcc/gimple-pretty-print.c	2008-07-09 10:23:21.000000000 +0200
--- gimple-tuples-branch/gcc/gimple-pretty-print.c	2008-07-09 16:39:55.000000000 +0200
*************** print_gimple_stmt (FILE *file, gimple g,
*** 97,103 ****
  {
    maybe_init_pretty_print (file);
    dump_gimple_stmt (&buffer, g, spc, flags);
!   pp_flush (&buffer);
  }


--- 97,104 ---- { maybe_init_pretty_print (file); dump_gimple_stmt (&buffer, g, spc, flags); ! if (!(flags & TDF_RHS_ONLY)) ! pp_flush (&buffer); }


*************** dump_gimple_assign (pretty_printer *buff *** 357,373 **** } else { ! dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false); ! pp_space (buffer); ! pp_character (buffer, '=');

!       if (gimple_assign_nontemporal_move_p (gs))
! 	pp_string (buffer, "{nt}");

!       if (gimple_has_volatile_ops (gs))
! 	pp_string (buffer, "{v}");

! pp_space (buffer);

        if (gimple_num_ops (gs) == 2)
          dump_unary_rhs (buffer, gs, spc, flags);
--- 358,377 ----
      }
    else
      {
!       if (!(flags & TDF_RHS_ONLY))
! 	{
! 	  dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
! 	  pp_space (buffer);
! 	  pp_character (buffer, '=');

! 	  if (gimple_assign_nontemporal_move_p (gs))
! 	    pp_string (buffer, "{nt}");

! 	  if (gimple_has_volatile_ops (gs))
! 	    pp_string (buffer, "{v}");

! 	  pp_space (buffer);
! 	}

        if (gimple_num_ops (gs) == 2)
          dump_unary_rhs (buffer, gs, spc, flags);
*************** dump_gimple_assign (pretty_printer *buff
*** 375,381 ****
          dump_binary_rhs (buffer, gs, spc, flags);
        else
          gcc_unreachable ();
!       pp_semicolon(buffer);
      }
  }

--- 379,386 ----
          dump_binary_rhs (buffer, gs, spc, flags);
        else
          gcc_unreachable ();
!       if (!(flags & TDF_RHS_ONLY))
! 	pp_semicolon(buffer);
      }
  }

*************** dump_gimple_call (pretty_printer *buffer
*** 453,459 ****
      }
    else
      {
!       if (lhs)
          {
            dump_generic_node (buffer, lhs, spc, flags, false);
            pp_string (buffer, " =");
--- 458,464 ----
      }
    else
      {
!       if (lhs && !(flags & TDF_RHS_ONLY))
          {
            dump_generic_node (buffer, lhs, spc, flags, false);
            pp_string (buffer, " =");
*************** dump_gimple_call (pretty_printer *buffer
*** 467,473 ****
        pp_string (buffer, " (");
        dump_gimple_call_args (buffer, gs, flags);
        pp_string (buffer, ")");
!       pp_semicolon (buffer);
      }

    if (gimple_call_chain (gs))
--- 472,479 ----
        pp_string (buffer, " (");
        dump_gimple_call_args (buffer, gs, flags);
        pp_string (buffer, ")");
!       if (!(flags & TDF_RHS_ONLY))
! 	pp_semicolon (buffer);
      }

if (gimple_call_chain (gs))
*************** dump_gimple_cond (pretty_printer *buffer
*** 533,558 ****
gimple_cond_true_label (gs), gimple_cond_false_label (gs));
else
{
! pp_string (buffer, "if (");
dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
pp_space (buffer);
pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
pp_space (buffer);
dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
! pp_string (buffer, ")");
! ! if (gimple_cond_true_label (gs))
! {
! pp_string (buffer, " goto ");
! dump_generic_node (buffer, gimple_cond_true_label (gs), spc, flags,
! false);
! }
! if (gimple_cond_false_label (gs))
! {
! pp_string (buffer, " else goto ");
! dump_generic_node (buffer, gimple_cond_false_label (gs), spc, flags,
! false);
! }
}
}


--- 539,568 ----
gimple_cond_true_label (gs), gimple_cond_false_label (gs));
else
{
! if (!(flags & TDF_RHS_ONLY))
! pp_string (buffer, "if (");
dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
pp_space (buffer);
pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
pp_space (buffer);
dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
! if (!(flags & TDF_RHS_ONLY))
! {
! pp_string (buffer, ")");
! ! if (gimple_cond_true_label (gs))
! {
! pp_string (buffer, " goto ");
! dump_generic_node (buffer, gimple_cond_true_label (gs),
! spc, flags, false);
! }
! if (gimple_cond_false_label (gs))
! {
! pp_string (buffer, " else goto ");
! dump_generic_node (buffer, gimple_cond_false_label (gs),
! spc, flags, false);
! }
! }
}
}


Index: gimple-tuples-branch/gcc/testsuite/gcc.dg/tree-ssa/pr25485.c
===================================================================
*** gimple-tuples-branch.orig/gcc/testsuite/gcc.dg/tree-ssa/pr25485.c	2008-07-09 10:23:10.000000000 +0200
--- gimple-tuples-branch/gcc/testsuite/gcc.dg/tree-ssa/pr25485.c	2008-07-09 16:43:43.000000000 +0200
*************** foo (int a, int b)
*** 13,17 ****
    return 31;
  }

! /* { dg-final { scan-tree-dump-times "Folding predicate in if " 1 "vrp1"} } */
  /* { dg-final { cleanup-tree-dump "vrp1" } } */
--- 13,17 ----
    return 31;
  }

! /* { dg-final { scan-tree-dump-times "if" 1 "vrp1"} } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
Index: gimple-tuples-branch/gcc/tree-pass.h
===================================================================
*** gimple-tuples-branch.orig/gcc/tree-pass.h 2008-07-03 13:59:36.000000000 +0200
--- gimple-tuples-branch/gcc/tree-pass.h 2008-07-09 16:21:53.000000000 +0200
*************** enum tree_dump_index
*** 72,78 ****
#define TDF_DIAGNOSTIC (1 << 15) /* A dump to be put in a diagnostic
message. */
#define TDF_VERBOSE (1 << 16) /* A dump that uses the full tree ! dumper to print stmts. */


extern char *get_dump_file_name (enum tree_dump_index);
extern int dump_enabled_p (enum tree_dump_index);
--- 72,80 ----
#define TDF_DIAGNOSTIC (1 << 15) /* A dump to be put in a diagnostic
message. */
#define TDF_VERBOSE (1 << 16) /* A dump that uses the full tree ! dumper to print stmts. */
! #define TDF_RHS_ONLY (1 << 17) /* a flag to only print the RHS of
! a gimple stmt. */


  extern char *get_dump_file_name (enum tree_dump_index);
  extern int dump_enabled_p (enum tree_dump_index);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]