[IPA] Fix renaming of return variable

Jan Hubicka jh@suse.cz
Tue Apr 11 18:04:00 GMT 2006


Hi,
tree-inliner sometimes called mark_sym_for_renaming on memory reference.
The easiest way I know about to unwind up to inner term is bellow, but I
am not quite convinced this is best way to go.  Ideas?
I am commiting it for now however.

Honza

2006-04-11  Jan Hubicka  <jh@suse.cz>
	* tree-inline.c (declare_return_variable): Be more cureful about what to rename.
Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 112732)
--- tree-inline.c	(working copy)
*************** declare_return_variable (copy_body_data 
*** 1467,1478 ****
  	  if (TREE_CODE (base_var) == SSA_NAME)
  	    base_var = SSA_NAME_VAR (base_var);
  	  if (in_ssa_p)
! 	    mark_sym_for_renaming (base_var);
  	  var = return_slot_addr;
  	}
        else
  	{
! 	  mark_sym_for_renaming (TREE_OPERAND (return_slot_addr, 0));
  	  var = build_fold_indirect_ref (return_slot_addr);
  	}
        if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE
--- 1467,1495 ----
  	  if (TREE_CODE (base_var) == SSA_NAME)
  	    base_var = SSA_NAME_VAR (base_var);
  	  if (in_ssa_p)
! 	    {
! 	      HOST_WIDE_INT bitsize;
! 	      HOST_WIDE_INT bitpos;
! 	      tree offset;
! 	      enum machine_mode mode;
! 	      int unsignedp;
! 	      int volatilep;
! 	      tree base;
! 	      base = get_inner_reference (base_var, &bitsize, &bitpos, &offset,
! 					  &mode, &unsignedp, &volatilep,
! 					  false);
! 	      if (TREE_CODE (base) == INDIRECT_REF)
! 		base = TREE_OPERAND (base, 0);
! 	      if (TREE_CODE (base) == SSA_NAME)
! 		base = SSA_NAME_VAR (base);
! 	      mark_sym_for_renaming (base);
! 	    }
  	  var = return_slot_addr;
  	}
        else
  	{
! 	  if (in_ssa_p)
! 	    mark_sym_for_renaming (TREE_OPERAND (return_slot_addr, 0));
  	  var = build_fold_indirect_ref (return_slot_addr);
  	}
        if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE



More information about the Gcc-patches mailing list