summaryrefslogtreecommitdiff
path: root/gcc/compare-elim.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/compare-elim.c')
-rw-r--r--gcc/compare-elim.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index 16576c44473..50bbaa84b6d 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -690,6 +690,13 @@ try_merge_compare (struct comparison *cmp)
return false;
rtx src = SET_SRC (set);
+
+ /* If the source uses addressing modes with side effects, we can't
+ do the merge because we'd end up with a PARALLEL that has two
+ instances of that side effect in it. */
+ if (side_effects_p (src))
+ return false;
+
rtx flags = maybe_select_cc_mode (cmp, src, CONST0_RTX (GET_MODE (src)));
if (!flags)
{
@@ -809,6 +816,12 @@ try_eliminate_compare (struct comparison *cmp)
else
return false;
+ /* If the source uses addressing modes with side effects, we can't
+ do the merge because we'd end up with a PARALLEL that has two
+ instances of that side effect in it. */
+ if (side_effects_p (cmp_src))
+ return false;
+
/* Determine if we ought to use a different CC_MODE here. */
flags = maybe_select_cc_mode (cmp, cmp_src, in_b);
if (flags == NULL)