re PR tree-optimization/21541 (gcc.c-torture/execute/20031215-1.c compilation fails)
authorRichard Henderson <rth@redhat.com>
Thu, 19 May 2005 06:29:45 +0000 (23:29 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 19 May 2005 06:29:45 +0000 (23:29 -0700)
        PR 21541
        * ifcvt.c (noce_process_if_block): Avoid conversion when the
        memory destination is readonly.

From-SVN: r99951

gcc/ChangeLog
gcc/ifcvt.c

index fb7cc49a0187f2b825a33bac7794e33f89eb7dca..10657a44a90fa9e2a2ac6790c868b50da1ea231c 100644 (file)
@@ -1,3 +1,9 @@
+2005-05-18  Richard Henderson  <rth@redhat.com>
+
+       PR 21541
+       * ifcvt.c (noce_process_if_block): Avoid conversion when the
+       memory destination is readonly.
+
 2005-05-18  Richard Henderson  <rth@redhat.com>
 
        PR 21541
index 8367316847f3c46a5e85c807d08d26a14f1862e8..be02aaa7d24f12991b13fd39c3de5ac523c79236 100644 (file)
@@ -1981,6 +1981,14 @@ noce_process_if_block (struct ce_if_block * ce_info)
   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