summaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-06 17:19:06 +0000
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-06 17:19:06 +0000
commit1040c3031aeba7ee0517b9c3fabc79ff7878bbe2 (patch)
tree96392c22e7f38eb3f9bb7ab19a5aeb2aa01fd0d8 /gcc/ifcvt.c
parentef13e68fc944c9e61712c02a56d818a083e4d450 (diff)
downloadgcc-1040c3031aeba7ee0517b9c3fabc79ff7878bbe2.tar.gz
PR target/11052
* ifcvt.c (noce_process_if_block): Fail if the destination has side-effects. gcc.c-torture/execute/20030606-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67558 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index baac0413176..87479060784 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1821,6 +1821,15 @@ noce_process_if_block (ce_info)
|| modified_between_p (x, PREV_INSN (if_info.cond_earliest), jump))
insn_b = set_b = NULL_RTX;
}
+
+ /* If x has side effects then only the if-then-else form is safe to
+ convert. But even in that case we would need to restore any notes
+ (such as REG_INC) at then end. That can be tricky if
+ noce_emit_move_insn expands to more than one insn, so disable the
+ optimization entirely for now if there are side effects. */
+ if (side_effects_p (x))
+ return FALSE;
+
b = (set_b ? SET_SRC (set_b) : x);
/* Only operate on register destinations, and even then avoid extending