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]

Re: [PATCH] Fix PR40495


On Sat, 20 Jun 2009, Richard Guenther wrote:

> 
> My last patch caused libgomp.c++/task-4.C to ICE (my bad - I forgot
> -k on the make check command so checking finished early...).  The
> following fixes it.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, tests still running.

Instead of fixing the type I just removed all the DECL creation
for the temps that never can end up in points-to sets.

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

Richard.

2009-06-20  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/40495
	* tree-ssa-structalias.c (get_constraint_exp_for_temp): Remove.
	(new_scalar_tmp_constraint_exp): New function.
	(process_constraint): Do not create temporary decls.
	(process_all_all_constraints): Likewise.
	(handle_const_call): Likewise.
	(create_function_info_for): Do not set decl.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c	(revision 148718)
--- gcc/tree-ssa-structalias.c	(working copy)
*************** get_vi_for_tree (tree t)
*** 2676,2695 ****
    return (varinfo_t) *slot;
  }
  
! /* Get a constraint expression for a new temporary variable.  */
  
  static struct constraint_expr
! get_constraint_exp_for_temp (tree t)
  {
!   struct constraint_expr cexpr;
  
!   gcc_assert (SSA_VAR_P (t));
  
!   cexpr.type = SCALAR;
!   cexpr.var = get_vi_for_tree (t)->id;
!   cexpr.offset = 0;
  
!   return cexpr;
  }
  
  /* Get a constraint expression vector from an SSA_VAR_P node.
--- 2676,2702 ----
    return (varinfo_t) *slot;
  }
  
! /* Get a scalar constraint expression for a new temporary variable.  */
  
  static struct constraint_expr
! new_scalar_tmp_constraint_exp (const char *name)
  {
!   struct constraint_expr tmp;
!   unsigned index = VEC_length (varinfo_t, varmap);
!   varinfo_t vi;
  
!   vi = new_var_info (NULL_TREE, index, name);
!   vi->offset = 0;
!   vi->size = -1;
!   vi->fullsize = -1;
!   vi->is_full_var = 1;
!   VEC_safe_push (varinfo_t, heap, varmap, vi);
  
!   tmp.var = vi->id;
!   tmp.type = SCALAR;
!   tmp.offset = 0;
  
!   return tmp;
  }
  
  /* Get a constraint expression vector from an SSA_VAR_P node.
*************** process_constraint (constraint_t t)
*** 2768,2790 ****
    if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id)
      {
        /* Split into tmp = *rhs, *lhs = tmp */
!       tree rhsdecl = get_varinfo (rhs.var)->decl;
!       tree pointertype = TREE_TYPE (rhsdecl);
!       tree pointedtotype = TREE_TYPE (pointertype);
!       tree tmpvar = create_tmp_var_raw (pointedtotype, "doubledereftmp");
!       struct constraint_expr tmplhs = get_constraint_exp_for_temp (tmpvar);
! 
        process_constraint (new_constraint (tmplhs, rhs));
        process_constraint (new_constraint (lhs, tmplhs));
      }
    else if (rhs.type == ADDRESSOF && lhs.type == DEREF)
      {
        /* Split into tmp = &rhs, *lhs = tmp */
!       tree rhsdecl = get_varinfo (rhs.var)->decl;
!       tree pointertype = TREE_TYPE (rhsdecl);
!       tree tmpvar = create_tmp_var_raw (pointertype, "derefaddrtmp");
!       struct constraint_expr tmplhs = get_constraint_exp_for_temp (tmpvar);
! 
        process_constraint (new_constraint (tmplhs, rhs));
        process_constraint (new_constraint (lhs, tmplhs));
      }
--- 2775,2790 ----
    if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id)
      {
        /* Split into tmp = *rhs, *lhs = tmp */
!       struct constraint_expr tmplhs;
!       tmplhs = new_scalar_tmp_constraint_exp ("doubledereftmp");
        process_constraint (new_constraint (tmplhs, rhs));
        process_constraint (new_constraint (lhs, tmplhs));
      }
    else if (rhs.type == ADDRESSOF && lhs.type == DEREF)
      {
        /* Split into tmp = &rhs, *lhs = tmp */
!       struct constraint_expr tmplhs;
!       tmplhs = new_scalar_tmp_constraint_exp ("derefaddrtmp");
        process_constraint (new_constraint (tmplhs, rhs));
        process_constraint (new_constraint (lhs, tmplhs));
      }
*************** do_deref (VEC (ce_s, heap) **constraints
*** 3091,3098 ****
  	c->type = SCALAR;
        else if (c->type == DEREF)
  	{
! 	  tree tmpvar = create_tmp_var_raw (ptr_type_node, "dereftmp");
! 	  struct constraint_expr tmplhs = get_constraint_exp_for_temp (tmpvar);
  	  process_constraint (new_constraint (tmplhs, *c));
  	  c->var = tmplhs.var;
  	}
--- 3091,3098 ----
  	c->type = SCALAR;
        else if (c->type == DEREF)
  	{
! 	  struct constraint_expr tmplhs;
! 	  tmplhs = new_scalar_tmp_constraint_exp ("dereftmp");
  	  process_constraint (new_constraint (tmplhs, *c));
  	  c->var = tmplhs.var;
  	}
*************** process_all_all_constraints (VEC (ce_s, 
*** 3261,3270 ****
    else
      {
        struct constraint_expr tmp;
!       tree tmpvar = create_tmp_var_raw (ptr_type_node, "allallcopytmp");
!       tmp.var = get_vi_for_tree (tmpvar)->id;
!       tmp.type = SCALAR;
!       tmp.offset = 0;
        for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); ++i)
  	process_constraint (new_constraint (tmp, *rhsp));
        for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
--- 3261,3267 ----
    else
      {
        struct constraint_expr tmp;
!       tmp = new_scalar_tmp_constraint_exp ("allalltmp");
        for (i = 0; VEC_iterate (ce_s, rhsc, i, rhsp); ++i)
  	process_constraint (new_constraint (tmp, *rhsp));
        for (i = 0; VEC_iterate (ce_s, lhsc, i, lhsp); ++i)
*************** handle_lhs_call (tree lhs, int flags, VE
*** 3472,3479 ****
  static void
  handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
  {
!   struct constraint_expr rhsc, tmpc = {SCALAR, 0, 0};
!   tree tmpvar = NULL_TREE;
    unsigned int k;
  
    /* Treat nested const functions the same as pure functions as far
--- 3469,3475 ----
  static void
  handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
  {
!   struct constraint_expr rhsc;
    unsigned int k;
  
    /* Treat nested const functions the same as pure functions as far
*************** handle_const_call (gimple stmt, VEC(ce_s
*** 3495,3521 ****
        if (could_have_pointers (arg))
  	{
  	  VEC(ce_s, heap) *argc = NULL;
  	  struct constraint_expr *argp;
- 	  int i;
- 
- 	  /* We always use a temporary here, otherwise we end up with
- 	     a quadratic amount of constraints for
- 	       large_struct = const_call (large_struct);
- 	     with field-sensitive PTA.  */
- 	  if (tmpvar == NULL_TREE)
- 	    {
- 	      tmpvar = create_tmp_var_raw (ptr_type_node, "consttmp");
- 	      tmpc = get_constraint_exp_for_temp (tmpvar);
- 	    }
- 
  	  get_constraint_for (arg, &argc);
! 	  for (i = 0; VEC_iterate (ce_s, argc, i, argp); i++)
! 	    process_constraint (new_constraint (tmpc, *argp));
! 	  VEC_free (ce_s, heap, argc);
  	}
      }
-   if (tmpvar != NULL_TREE)
-     VEC_safe_push (ce_s, heap, *results, &tmpc);
  
    /* May return addresses of globals.  */
    rhsc.var = nonlocal_id;
--- 3491,3504 ----
        if (could_have_pointers (arg))
  	{
  	  VEC(ce_s, heap) *argc = NULL;
+ 	  unsigned i;
  	  struct constraint_expr *argp;
  	  get_constraint_for (arg, &argc);
! 	  for (i = 0; VEC_iterate (ce_s, argc, i, argp); ++i)
! 	    VEC_safe_push (ce_s, heap, *results, argp);
! 	  VEC_free(ce_s, heap, argc);
  	}
      }
  
    /* May return addresses of globals.  */
    rhsc.var = nonlocal_id;
*************** create_function_info_for (tree decl, con
*** 4280,4286 ****
    /* Create the variable info.  */
  
    vi = new_var_info (decl, index, name);
-   vi->decl = decl;
    vi->offset = 0;
    vi->size = 1;
    vi->fullsize = count_num_arguments (decl, &is_varargs) + 1;
--- 4263,4268 ----
*************** create_function_info_for (tree decl, con
*** 4320,4326 ****
        free (tempname);
  
        argvi = new_var_info (argdecl, newindex, newname);
-       argvi->decl = argdecl;
        VEC_safe_push (varinfo_t, heap, varmap, argvi);
        argvi->offset = i;
        argvi->size = 1;
--- 4302,4307 ----
*************** create_function_info_for (tree decl, con
*** 4356,4362 ****
        free (tempname);
  
        resultvi = new_var_info (resultdecl, newindex, newname);
-       resultvi->decl = resultdecl;
        VEC_safe_push (varinfo_t, heap, varmap, resultvi);
        resultvi->offset = i;
        resultvi->size = 1;
--- 4337,4342 ----
*************** create_variable_info_for (tree decl, con
*** 4418,4424 ****
       sort the field list and create fake variables for all the
       fields.  */
    vi = new_var_info (decl, index, name);
-   vi->decl = decl;
    vi->offset = 0;
    vi->may_have_pointers = could_have_pointers (decl);
    if (!declsize
--- 4398,4403 ----


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