On Tue, 13 Apr 2010, Sebastian Pop wrote:

> On Tue, Apr 13, 2010 at 13:14, Sebastian Pop <seb...@gmail.com> wrote:
> > Hi,
> >
> > While working on the tree-if-conv.c, I realized that the copy
> > of the contents of a non scalar variable are not correctly done.
> > The copy assignment triggers this error:
> >
> > error: virtual SSA name for non-VOP decl
> > while verifying SSA_NAME _ifc_.2005_46 in statement
> > # .MEM_394 = VDEF <.MEM_475>
> >    _ifc_.2005_46 = ops[j_457];
> >
> > The array reference looks like this:
> >
> >  <array_ref 0x7ffff4bd65a0
> >    type <record_type 0x7ffff4ee2c78 simplify_plus_minus_op_data
> > sizes-gimplified asm_written type_0 BLK
> >
> > For scalar types, the code that creates the copy is working correctly:
> >
> > /* Create a new temp variable of type TYPE.  Add GIMPLE_ASSIGN to assign EXP
> >   to the new variable.  */
> >
> > static gimple
> > ifc_temp_var (tree type, tree exp)
> > {
> >  const char *name = "_ifc_";
> >  tree var, new_name;
> >  gimple stmt;
> >
> >  /* Create new temporary variable.  */
> >  var = create_tmp_var (type, name);
> >  add_referenced_var (var);
> >
> >  /* Build new statement to assign EXP to new variable.  */
> >  stmt = gimple_build_assign (var, exp);
> >
> >  /* Get SSA name for the new variable and set make new statement
> >     its definition statement.  */
> >  new_name = make_ssa_name (var, stmt);
> >  gimple_assign_set_lhs (stmt, new_name);
> >  SSA_NAME_DEF_STMT (new_name) = stmt;
> >  update_stmt (stmt);
> >
> >  return stmt;
> > }
> >
> > What is missing in this function to make it handle non scalar types?
> >
> 
> At least this is missing (but it is not enough, so I am still looking for
> a solution):
> 
>   if (gimple_referenced_vars (cfun))
>     {
>       add_referenced_var (t);
>       mark_sym_for_renaming (t);
>     }
> 
> from tree-dfa.c:
> 
> /* Build a temporary.  Make sure and register it to be renamed.  */
> 
> tree
> make_rename_temp (tree type, const char *prefix)
> {
>   tree t = create_tmp_var (type, prefix);
> 
>   if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
>       || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
>     DECL_GIMPLE_REG_P (t) = 1;
> 
>   if (gimple_referenced_vars (cfun))
>     {
>       add_referenced_var (t);
>       mark_sym_for_renaming (t);
>     }
> 
>   return t;
> }
> 
> I will replace the call to create_tmp_var with make_rename_temp.

No.  make_rename_temp should go away.  Please.

Btw, you can't make an SSA name of aggregate type.

Richard.

Reply via email to