aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>1998-11-18 14:15:03 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>1998-11-18 14:15:03 +0000
commitf3f2255a8ce7120d21a2b7616ea53d45004dddea (patch)
tree8921dc600627277c943d30827bee035beec4e997
parent59e76fc6ba25be94f98194ec5e4accdac8a50315 (diff)
downloadgcc-f3f2255a8ce7120d21a2b7616ea53d45004dddea.zip
gcc-f3f2255a8ce7120d21a2b7616ea53d45004dddea.tar.gz
gcc-f3f2255a8ce7120d21a2b7616ea53d45004dddea.tar.bz2
expr.c (store_expr): Don't generate load-store pair if TEMP is identical (according to ==) with TARGET.
* expr.c (store_expr): Don't generate load-store pair if TEMP is identical (according to ==) with TARGET. From-SVN: r23696
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expr.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bb0fe6b..59cb657 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Wed Nov 18 22:13:00 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * expr.c (store_expr): Don't generate load-store pair
+ if TEMP is identical (according to ==) with TARGET.
+
Tue Nov 17 22:25:16 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* reload1.c (reload_reg_free_for_value_p): When considered reload
diff --git a/gcc/expr.c b/gcc/expr.c
index 1dd7cb7..3d46dea 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3676,10 +3676,21 @@ store_expr (exp, target, want_value)
/* If value was not generated in the target, store it there.
Convert the value to TARGET's type first if nec. */
+ /* If TEMP and TARGET compare equal according to rtx_equal_p, but
+ one or both of them are volatile memory refs, we have to distinguish
+ two cases:
+ - expand_expr has used TARGET. In this case, we must not generate
+ another copy. This can be detected by TARGET being equal according
+ to == .
+ - expand_expr has not used TARGET - that means that the source just
+ happens to have the same RTX form. Since temp will have been created
+ by expand_expr, it will compare unequal according to == .
+ We must generate a copy in this case, to reach the correct number
+ of volatile memory references. */
if ((! rtx_equal_p (temp, target)
- || side_effects_p (temp)
- || side_effects_p (target))
+ || (temp != target && (side_effects_p (temp)
+ || side_effects_p (target))))
&& TREE_CODE (exp) != ERROR_MARK)
{
target = protect_from_queue (target, 1);