This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch applied to expr.c


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.

Index: expr.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/expr.c,v
retrieving revision 1.107
diff -p -r1.107 expr.c
*** expr.c	1998/10/28 10:30:46	1.107
--- expr.c	1998/11/18 22:13:57
*************** store_expr (exp, target, want_value)
*** 3676,3685 ****
  
    /* If value was not generated in the target, store it there.
       Convert the value to TARGET's type first if nec.  */
  
    if ((! rtx_equal_p (temp, target)
!        || side_effects_p (temp)
!        || side_effects_p (target))
        && TREE_CODE (exp) != ERROR_MARK)
      {
        target = protect_from_queue (target, 1);
--- 3676,3696 ----
  
    /* 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)
!        || (temp != target && (side_effects_p (temp)
! 			      || side_effects_p (target))))
        && TREE_CODE (exp) != ERROR_MARK)
      {
        target = protect_from_queue (target, 1);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]