Hello,
> But of course the following is the problem:
>
> Index: fold-const.c
> ===================================================================
> *** fold-const.c (revision 121992)
> --- fold-const.c (working copy)
> *************** tree_swap_operands_p (tree arg0, tree ar
> *** 6668,6676 ****
> && (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1)))
> return 0;
>
> ! if (DECL_P (arg1))
> return 0;
> ! if (DECL_P (arg0))
> return 1;
>
> /* It is preferable to swap two SSA_NAME to ensure a canonical form
> --- 6668,6676 ----
> && (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1)))
> return 0;
>
> ! if (DECL_P (arg1) || TREE_CODE (arg1) == SSA_NAME)
> return 0;
> ! if (DECL_P (arg0) || TREE_CODE (arg0) == SSA_NAME)
> return 1;
>
> /* It is preferable to swap two SSA_NAME to ensure a canonical form
>
> I'll bootstrap and test it.
makes sense, although it won't fix the problem in general (e.g.,
2 * a < 2 * a + 4 still would not be folded).