+2001-03-13 Jakub Jelinek <jakub@redhat.com>
+
+ * expr.c (store_expr): Add dont_store_target. If temp is already in
+ target before copying to reg, don't store it into target again.
+
2001-03-12 Neil Booth <neil@daikokuya.demon.co.uk>
* cppinternals.texi: Update for file handling.
{
register rtx temp;
int dont_return_target = 0;
+ int dont_store_target = 0;
if (TREE_CODE (exp) == COMPOUND_EXPR)
{
{
temp = expand_expr (exp, target, GET_MODE (target), 0);
if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
- temp = copy_to_reg (temp);
+ {
+ /* If TEMP is already in the desired TARGET, only copy it from
+ memory and don't store it there again. */
+ if (temp == target
+ || (rtx_equal_p (temp, target)
+ && ! side_effects_p (temp) && ! side_effects_p (target)))
+ dont_store_target = 1;
+ temp = copy_to_reg (temp);
+ }
dont_return_target = 1;
}
else if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
if ((! rtx_equal_p (temp, target)
|| (temp != target && (side_effects_p (temp)
|| side_effects_p (target))))
- && TREE_CODE (exp) != ERROR_MARK)
+ && TREE_CODE (exp) != ERROR_MARK
+ && ! dont_store_target)
{
target = protect_from_queue (target, 1);
if (GET_MODE (temp) != GET_MODE (target)