* ifcvt.c (noce_process_if_block): Avoid conversion when the
memory destination is readonly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99951
138bc75d-0d04-0410-961f-
82ee72b054a4
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
* tree-ssa-operands.c (opf_non_specific): New.
(get_asm_expr_operands): Set it.
(add_call_clobber_ops, add_call_read_ops): Likewise.
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