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: Eric Botcazou <ebotcazou at adacore dot com>
- To: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 20 Oct 2005 19:03:53 +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>
> This patch fixes pr19672 (pessimized code for a loop whose condition has
> && or ||) by adding a special-cased expansion of TRUTH_AND_EXPR and
> TRUTH_OR_EXPR in do_jump.
>
> Like COND_EXPR or NE_EXPR, it makes sense to have a special expansion so
> that
>
> if (a || b) goto xy;
>
> can be translated to
>
> if (a) goto xy;
> if (b) goto xy;
Hum...
/* ANDIF and ORIF allow the second operand not to be computed if the
value of the expression is determined from the first operand. AND,
OR, and XOR always compute the second operand whether its value is
needed or not (for side effects). The operand may have
BOOLEAN_TYPE or INTEGER_TYPE. In either case, the argument will be
either zero or one. For example, a TRUTH_NOT_EXPR will never have
an INTEGER_TYPE VAR_DECL as its argument; instead, a NE_EXPR will be
used to compare the VAR_DECL to zero, thereby obtaining a node with
value zero or one. */
DEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", 'e', 2)
DEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", 'e', 2)
DEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", 'e', 2)
DEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", 'e', 2)
DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", 'e', 2)
DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", 'e', 1)
Ada is badly broken, please revert.
Thanks in advance.
--
Eric Botcazou