dojump.c (do_jump): Handle side-effecting TRUTH_AND_EXPR and TRUTH_OR_EXPR.
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 21 Oct 2005 07:28:48 +0000 (07:28 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Fri, 21 Oct 2005 07:28:48 +0000 (07:28 +0000)
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

gcc/ChangeLog
gcc/dojump.c

index ddb8253850944fcca888ca89a04e6a4b7a9717ea..06f3913da62d19ac88570077e059bbcfe1a1d8c1 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-21  Paolo Bonzini  <bonzini@gnu.org>
+
+       * dojump.c (do_jump): Handle side-effecting TRUTH_AND_EXPR and
+       TRUTH_OR_EXPR.
+
 2005-10-20  Steven Bosscher  <stevenb@suse.de>
 
        PR tree-optimization/24225
index 6dca9d32b57ba38697d6a36ec803fdbd76454757..d65347ec67cd1f54ab93c3bc272609aa5ebf6259 100644 (file)
@@ -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)