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]

[tree-ssa, RFC] Fix invalid sharing within tree-inline.c


Hi,
tree-inline may, as special case, condier INDIRECT_REF when inlining
invisible references (and gets lucky enought to apparently not produce
non-gimples on a way):

      /* See if the frontend wants to pass this by invisible reference.  If
	 so, our new VAR_DECL will have REFERENCE_TYPE, and we need to
	 replace uses of the PARM_DECL with dereferences.  */
      if (TREE_TYPE (var) != TREE_TYPE (p)
	  && POINTER_TYPE_P (TREE_TYPE (var))
	  && TREE_TYPE (TREE_TYPE (var)) == TREE_TYPE (p))
	var_sub = build1 (INDIRECT_REF, TREE_TYPE (p), var);

Does this look like sane fix?
I am somewhat nervous about the posibility of producing non-gimples this
way, but I see absolutely no way to prevent it.  I think we must handle
this on gimplifier side and consider all uses of such PARM_DECLs to be
non-gimple-val that we apparently do now.  Right?
Honza

2003-12-12  Jan Hubicka  <jh@suse.cz>
	* tree-inline.c (copy_body_r): Unshare INDIRECT_REF.
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.69
diff -c -3 -p -r1.26.2.69 tree-inline.c
*** tree-inline.c	9 Dec 2003 15:39:11 -0000	1.26.2.69
--- tree-inline.c	11 Dec 2003 22:17:15 -0000
*************** copy_body_r (tree *tp, int *walk_subtree
*** 510,515 ****
--- 510,517 ----
        new_decl = remap_decl (*tp, id);
        if (! new_decl)
  	abort ();
+       if (TREE_CODE (new_decl) == INDIRECT_REF)
+ 	new_decl = copy_node (new_decl);
        /* Replace this variable with the copy.  */
        STRIP_TYPE_NOPS (new_decl);
        *tp = new_decl;


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