From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13919 invoked by alias); 13 Apr 2010 19:43:23 -0000 Received: (qmail 13911 invoked by uid 22791); 13 Apr 2010 19:43:22 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SARE_MSGID_LONG45,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-bw0-f215.google.com (HELO mail-bw0-f215.google.com) (209.85.218.215) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Apr 2010 19:43:17 +0000 Received: by bwz7 with SMTP id 7so2936702bwz.16 for ; Tue, 13 Apr 2010 12:43:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.112.76 with HTTP; Tue, 13 Apr 2010 12:42:55 -0700 (PDT) In-Reply-To: References: From: Sebastian Pop Date: Tue, 13 Apr 2010 19:47:00 -0000 Received: by 10.223.65.18 with SMTP id g18mr3692450fai.32.1271187795251; Tue, 13 Apr 2010 12:43:15 -0700 (PDT) Message-ID: Subject: Re: Copy assignments for non scalar types To: gcc@gcc.gnu.org, Richard Guenther , Diego Novillo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-04/txt/msg00301.txt.bz2 On Tue, Apr 13, 2010 at 13:14, Sebastian Pop 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 =3D VDEF <.MEM_475> > =A0 =A0_ifc_.2005_46 =3D ops[j_457]; > > The array reference looks like this: > > =A0 =A0 =A0type 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. =A0Add GIMPLE_ASSIGN to assig= n EXP > =A0 to the new variable. =A0*/ > > static gimple > ifc_temp_var (tree type, tree exp) > { > =A0const char *name =3D "_ifc_"; > =A0tree var, new_name; > =A0gimple stmt; > > =A0/* Create new temporary variable. =A0*/ > =A0var =3D create_tmp_var (type, name); > =A0add_referenced_var (var); > > =A0/* Build new statement to assign EXP to new variable. =A0*/ > =A0stmt =3D gimple_build_assign (var, exp); > > =A0/* Get SSA name for the new variable and set make new statement > =A0 =A0 its definition statement. =A0*/ > =A0new_name =3D make_ssa_name (var, stmt); > =A0gimple_assign_set_lhs (stmt, new_name); > =A0SSA_NAME_DEF_STMT (new_name) =3D stmt; > =A0update_stmt (stmt); > > =A0return 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 =3D create_tmp_var (type, prefix); if (TREE_CODE (TREE_TYPE (t)) =3D=3D COMPLEX_TYPE || TREE_CODE (TREE_TYPE (t)) =3D=3D VECTOR_TYPE) DECL_GIMPLE_REG_P (t) =3D 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. Sebastian