From: Jeffrey A Law Date: Thu, 11 Feb 1999 00:57:47 +0000 (+0000) Subject: expr.c (store_expr): Don't generate load-store pair if TEMP is identical (according... X-Git-Tag: prereleases/egcs-1.1.2-prerelease-1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2ba9fd561bfb60cb959552a73b4e42b135938d4;p=thirdparty%2Fgcc.git expr.c (store_expr): Don't generate load-store pair if TEMP is identical (according to ==) with TARGET. Wed Nov 18 22:13:00 1998 J"orn Rennecke * expr.c (store_expr): Don't generate load-store pair if TEMP is identical (according to ==) with TARGET. Bring over from the mainline tree. Fixes bugs with volatile memory references being read/written too many times. From-SVN: r25151 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cd635564a26b..17cbbf102acd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Thu Feb 11 01:53:10 1999 Jeffrey A Law (law@cygnus.com) + + Wed Nov 18 22:13:00 1998 J"orn Rennecke + * expr.c (store_expr): Don't generate load-store pair + if TEMP is identical (according to ==) with TARGET. + Thu Feb 11 01:06:49 1999 Nathan Sidwell * fold-const.c (range_binop): Take account of the bounded nature diff --git a/gcc/expr.c b/gcc/expr.c index 706718dcab46..f88d5edfbd62 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -3457,10 +3457,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);