Fix fallout of patch for PR rtl-optimization/54315

Eric Botcazou ebotcazou@adacore.com
Sat Nov 10 15:32:00 GMT 2012


In the patch I installed for PR rtl-optimization/54315:
  http://gcc.gnu.org/ml/gcc-patches/2012-10/msg00745.html
the special code dealing with BLKmode in registers at the beginning of 
store_field is disabled for CALL_EXPR:

  /* If we are storing into an unaligned field of an aligned union that is
     in a register, we may have the mode of TARGET being an integer mode but
     MODE == BLKmode.  In that case, get an aligned object whose size and
     alignment are the same as TARGET and store TARGET into it (we can avoid
     the store if the field being stored is the entire width of TARGET).  Then
     call ourselves recursively to store the field into a BLKmode version of
     that object.  Finally, load from the object into TARGET.  This is not
     very efficient in general, but should only be slightly more expensive
     than the otherwise-required unaligned accesses.  Perhaps this can be
     cleaned up later.  It's tempting to make OBJECT readonly, but it's set
     twice, once with emit_move_insn and once via store_field.  */

  if (mode == BLKmode
      && (REG_P (target) || GET_CODE (target) == SUBREG)
      && TREE_CODE (exp) != CALL_EXPR)
    {
      rtx object = assign_temp (type, 1, 1);
      rtx blk_object = adjust_address (object, BLKmode, 0);

      if (bitsize != (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (target)))
	emit_move_insn (object, target);

      store_field (blk_object, bitsize, bitpos,
		   bitregion_start, bitregion_end,
		   mode, exp, type, MEM_ALIAS_SET (blk_object), nontemporal);

      emit_move_insn (target, object);

      /* We want to return the BLKmode version of the data.  */
      return blk_object;
    }

because PR rtl-optimization/54315 is about useless spills to the stack for 
BLKmode values returned in registers.  I didn't realize that this change also 
affects the other 2 kinds of targets, namely those returning BLKmode values by 
means of PARALLEL and those returning BLKmode values in memory.  It turns out 
that the change introduced 2 ACATS failures on SPARC64 (former kind) and 1 
ACATS failure on SPARC (letter kind) because of this oversight.

Therefore, the attached patch adds the missing bits to store_field for the 
other 2 kinds of targets, thus fixing the introduced regressions.  However, 
the code used for the latter kind is generic, i.e. it doesn't require that the 
object being stored be a value returned from a function.  As such, it makes 
the above block of code totally useless.  So the patch removes it altogether, 
which makes the TYPE parameter of store_field useless, which in turn makes 
the same parameter of store_constructor_field useless as well.

Bootstrapped/regtested on x86_64-suse-linux, sparc64-sun-solaris2.9, sparc-
sun-solaris2.10, powerpc-linux-gnu, ia64-linux-gnu and mips64el-linux-gnu
and applied on the mainline.


2012-11-10  Eric Botcazou  <ebotcazou@adacore.com>

	* expr.c (store_field): Remove TYPE parameter.  Remove block of code
	dealing with BLKmode in registers.  Reimplement this support using
	pseudo-registers and bit-field techniques.
	(store_constructor_field): Remove TYPE parameter and adjust calls to
	store_field.
	(expand_assignment): Adjust calls to store_field.  Add comment.
	(store_expr): Add comment.
	(store_constructor): Adjust calls to store_constructor_field.
	(expand_expr_real_2): Adjust call to store_field.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 10092 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20121110/cf4e1829/attachment.bin>


More information about the Gcc-patches mailing list