On Fri, 20 Sep 2019, Yuliang Wang wrote:
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.
IIRC, the conditions in this function always seemed bogus to me. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57755 and links. I don't know
if it is still relevant...
--
Marc Glisse