aboutsummaryrefslogtreecommitdiff
path: root/gcc/dojump.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2005-10-21 07:28:48 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2005-10-21 07:28:48 +0000
commit97191ef99f43fe7d02d356002892920c06476457 (patch)
treee3e8a6eb7343f54e5e75d9c82ee12a37c79facee /gcc/dojump.c
parentb68fe99446924d7a128ffceec09d2644055880ea (diff)
downloadgcc-97191ef99f43fe7d02d356002892920c06476457.zip
gcc-97191ef99f43fe7d02d356002892920c06476457.tar.gz
gcc-97191ef99f43fe7d02d356002892920c06476457.tar.bz2
dojump.c (do_jump): Handle side-effecting TRUTH_AND_EXPR and TRUTH_OR_EXPR.
2005-10-21 Paolo Bonzini <bonzini@gnu.org> * dojump.c (do_jump): Handle side-effecting TRUTH_AND_EXPR and TRUTH_OR_EXPR. From-SVN: r105723
Diffstat (limited to 'gcc/dojump.c')
-rw-r--r--gcc/dojump.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 6dca9d3..d65347e 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -511,8 +511,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
break;
case TRUTH_AND_EXPR:
- /* High branch cost, expand as the bitwise AND of the conditions. */
- if (BRANCH_COST >= 4)
+ /* High branch cost, expand as the bitwise AND of the conditions.
+ Do the same if the RHS has side effects, because we're effectively
+ turning a TRUTH_AND_EXPR into a TRUTH_ANDIF_EXPR. */
+ if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
goto normal;
if (if_false_label == NULL_RTX)
@@ -529,8 +531,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
break;
case TRUTH_OR_EXPR:
- /* High branch cost, expand as the bitwise OR of the conditions. */
- if (BRANCH_COST >= 4)
+ /* High branch cost, expand as the bitwise OR of the conditions.
+ Do the same if the RHS has side effects, because we're effectively
+ turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */
+ if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
goto normal;
if (if_true_label == NULL_RTX)