optabs.c (expand_binop): Attempt to reuse pseudos for duplicate non-volatile operands of binary operations.

* optabs.c (expand_binop): Attempt to reuse pseudos for duplicate
	non-volatile operands of binary operations.
	(prepare_cmp_insn): Likewise.

From-SVN: r67417
This commit is contained in:
Roger Sayle 2003-06-04 04:40:26 +00:00 committed by Roger Sayle
parent 1063147cc0
commit 894207cf0a
2 changed files with 28 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2003-06-03 Roger Sayle <roger@eyesopen.com>
* optabs.c (expand_binop): Attempt to reuse pseudos for duplicate
non-volatile operands of binary operations.
(prepare_cmp_insn): Likewise.
2003-06-03 Roger Sayle <roger@eyesopen.com>
* varasm.c (force_const_mem): Handle alignment of constants not

View File

@ -700,8 +700,17 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (flag_force_mem)
{
op0 = force_not_mem (op0);
op1 = force_not_mem (op1);
/* Load duplicate non-volatile operands once. */
if (rtx_equal_p (op0, op1) && ! volatile_refs_p (op0))
{
op0 = force_not_mem (op0);
op1 = op0;
}
else
{
op0 = force_not_mem (op0);
op1 = force_not_mem (op1);
}
}
/* If subtracting an integer constant, convert this into an addition of
@ -3587,8 +3596,17 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, purpose)
if (mode != BLKmode && flag_force_mem)
{
x = force_not_mem (x);
y = force_not_mem (y);
/* Load duplicate non-volatile operands once. */
if (rtx_equal_p (x, y) && ! volatile_refs_p (x))
{
x = force_not_mem (x);
y = x;
}
else
{
x = force_not_mem (x);
y = force_not_mem (y);
}
}
/* If we are inside an appropriately-short loop and one operand is an