Hi Richard,
Thanks for your comments and tips. fold_binary_op_with_conditional_arg performs the reverse transformation to this patch in certain situations:
/* Transform `a + (b ? x : y)' into `b ? (a + x) : (a + y)'.
... */
static tree
fold_binary_op_with_conditional_arg (location_t loc,
...
/* This transformation is only worthwhile if we don't have to wrap ARG
in a SAVE_EXPR and the operation can be simplified without recursing
on at least one of the branches once its pushed inside the COND_EXPR. */
if (!TREE_CONSTANT (arg)
&& (TREE_SIDE_EFFECTS (arg) ...)
return NULL_TREE;
...
For instance, this causes infinite recursion in gcc.dg/vect/fast-math-vect-call-2 because ARG is a float literal.