This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] (-fstrict-overflow) optimize counted loops on signed iv


On 2/15/07, Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> wrote:
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).

That's true. I have no strong opinion on whether we should handle this by canonicalization or by making the transformation handle both cases.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]