https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63743
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is just operand canonicalization according to tree_swap_operands which is
now consistently applied. It was a bug that it wasn't applied before (the
usual offender here is SSA rewriting that doesn't fold "changed" statements
nor re-canonicalizes).
You are just (un)lucky btw, try both
double
test1 (double x, double y)
{
double tem = x + y;
double tem2 = x;
return tem2 * tem;
}
and
double
test1 (double x, double y)
{
double tem = x + y;
double tem2 = x;
return tem * tem2;
}
there is nothing that forces ordering in the way you would prefer it. So as
Jakub says - this needs addressing in RTL expansion and/or TER and SSA
coalescing.