This is the mail archive of the 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]
Other format: [Raw text]

finish fixing 21541

As described in my previous message.  Tested on i686-linux.


        PR 21541
        * ifcvt.c (noce_process_if_block): Avoid conversion when the
        memory destination is readonly.

Index: ifcvt.c
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.186
diff -u -p -d -r1.186 ifcvt.c
--- ifcvt.c	21 Apr 2005 15:47:23 -0000	1.186
+++ ifcvt.c	19 May 2005 06:27:46 -0000
@@ -1981,6 +1981,14 @@ noce_process_if_block (struct ce_if_bloc
   if (side_effects_p (x))
     return FALSE;
+  /* If x is a read-only memory, then the program is valid only if we
+     avoid the store into it.  If there are stores on both the THEN and
+     ELSE arms, then we can go ahead with the conversion; either the 
+     program is broken, or the condition is always false such that the
+     other memory is selected.  */
+  if (!set_b && MEM_P (x) && MEM_READONLY_P (x))
+    return FALSE;
   b = (set_b ? SET_SRC (set_b) : x);
   /* Only operate on register destinations, and even then avoid extending

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