This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.1/4.0/3.4] fix pr19672 by tuning expansion of TRUTH_{AND,OR}_EXPR



Ada is badly broken, please revert.


Could you please test changing

if (BRANCH_COST >= 4)

to

 if (BRANCH_COST >= 4
    || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))

as in the attached patch (which is untested, but should apply to 4.1 and 4.0 and, with some fuzz, to 3.4 as well)?

Thanks.

Paolo
Index: dojump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dojump.c,v
retrieving revision 1.43
diff -p -u -u -r1.43 dojump.c
--- dojump.c	19 Oct 2005 10:37:31 -0000	1.43
+++ dojump.c	20 Oct 2005 17:04:01 -0000
@@ -512,7 +512,7 @@ do_jump (tree exp, rtx if_false_label, r
 
     case TRUTH_AND_EXPR:
       /* High branch cost, expand as the bitwise AND of the conditions.  */
-      if (BRANCH_COST >= 4)
+      if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
 	goto normal;
 
       if (if_false_label == NULL_RTX)
@@ -530,7 +530,7 @@ do_jump (tree exp, rtx if_false_label, r
 
     case TRUTH_OR_EXPR:
       /* High branch cost, expand as the bitwise OR of the conditions.  */
-      if (BRANCH_COST >= 4)
+      if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
 	goto normal;
 
       if (if_true_label == NULL_RTX)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]