On 9/27/06, Roberto COSTA <[EMAIL PROTECTED]> wrote:
Daniel Berlin wrote:
> On 9/27/06, Roberto COSTA <[EMAIL PROTECTED]> wrote:
>
>> Hello,
>> I have a question about the form of COND_EXPR nodes allowed in GIMPLE
>> representation.
>> By looking at what gimplify.c does (more precisely, at function
>> gimplify_cond_expr (...) ), I understood that GIMPLE only allows a
>> restricted form of COND_EXPR, in which both 'then' and 'else' operands
>> are GOTO_EXPR nodes.
>
>
> This is true for the conditional form that appears as a statement
>
>> However, when compiling with -ftree-vectorize command-line option, there
>> are cases of COND_EXPR nodes generated and not gimplified (in the sense
>> of my previous sentence).
>
>
> However, it is possible for them to also appear on the RHS of a
> MODIFY_EXPR in order to represent the results of if-conversion.
>
> IE
> a = b ? c : d
>
> In this form, I believe each arm is required to be an SSA_VAR_P
>
> The way to differentiate the two is that the first form *only* appears
> as a statement, and the second form *only* appears on the RHS of a
> MODIFY_EXPR.
Thanks for the explanation.
The COND_EXPRs I saw were indeed of this second form.
What is a bit surprising at second sight (first sight was my point of
view while writing the first message) is that gimplify pass expands the
COND_EXPRs of the second form into control-flow.
Therefore, it looks
like the only ones that can be found after gimplification are those
generated by a further pass.
Yes. This is also true for a few other expressions. IIRC, the
gimplifier expands MAX_EXPR into control flow, even though it is legal
gimple. However, tree-loop-linear will generate them as part of
computing loop bounds expressions, for example.
The usual reason for this type of thing is that the ability to have
them as the RHS of a MODIFY_EXPR was added much later than the
gimplifier, and it was decided that in order to avoid possible
performance regressions, the existing behavior of lowering wouldn't be
changed.
If, of course, there is some good reason to always use the data
dependent form over the control dependent form, we're always willing
to explore changing the gimplifier to not do the lowering.