summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-13 12:09:31 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-13 12:09:31 +0000
commitafadb0ab58dd8780888e7ae473c0b156f9960d24 (patch)
tree2eec962143d9f07ec03d7ae379aa9ee15d891eee
parente2d8f0184e661b2c5d24bb75c76555178c529296 (diff)
downloadppe42-gcc-afadb0ab58dd8780888e7ae473c0b156f9960d24.tar.gz
ppe42-gcc-afadb0ab58dd8780888e7ae473c0b156f9960d24.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40437 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expr.c14
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e3fa88eed7..6bde0bc234f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+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.
diff --git a/gcc/expr.c b/gcc/expr.c
index ff3f5bf354d..382bb234916 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3905,6 +3905,7 @@ store_expr (exp, target, want_value)
{
register rtx temp;
int dont_return_target = 0;
+ int dont_store_target = 0;
if (TREE_CODE (exp) == COMPOUND_EXPR)
{
@@ -3975,7 +3976,15 @@ store_expr (exp, target, want_value)
{
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))
@@ -4105,7 +4114,8 @@ store_expr (exp, target, want_value)
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)
OpenPOWER on IntegriCloud