summaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-13 00:49:27 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-13 00:49:27 +0000
commit3fdc20c83c31dd06346ff9f01acf0c8b0dd9673b (patch)
tree34098daa96824d3e738563cea60cf44c47b0adb0 /gcc/ifcvt.c
parentb20e5c5c8d67a64d6488c8cd12bc34eb461929d2 (diff)
downloadgcc-3fdc20c83c31dd06346ff9f01acf0c8b0dd9673b.tar.gz
PR rtl-optimization/41087
* ifcvt.c (noce_get_condition): Don't allow conditions with side-effects. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164240 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 9ac4b13caa7..9aff583ae45 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2201,8 +2201,15 @@ noce_get_condition (rtx jump, rtx *earliest, bool then_else_reversed)
/* Otherwise, fall back on canonicalize_condition to do the dirty
work of manipulating MODE_CC values and COMPARE rtx codes. */
- return canonicalize_condition (jump, cond, reverse, earliest,
- NULL_RTX, false, true);
+ tmp = canonicalize_condition (jump, cond, reverse, earliest,
+ NULL_RTX, false, true);
+
+ /* We don't handle side-effects in the condition, like handling
+ REG_INC notes and making sure no duplicate conditions are emitted. */
+ if (tmp != NULL_RTX && side_effects_p (tmp))
+ return NULL_RTX;
+
+ return tmp;
}
/* Return true if OP is ok for if-then-else processing. */