This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.1/4.0/3.4] fix pr19672 by tuning expansion of TRUTH_{AND,OR}_EXPR
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 20 Oct 2005 19:05:04 +0200
- Subject: Re: [4.1/4.0/3.4] fix pr19672 by tuning expansion of TRUTH_{AND,OR}_EXPR
- References: <43552D67.4040301@lu.unisi.ch> <200510201903.53711.ebotcazou@adacore.com>
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)