This is the mail archive of the gcc@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: Question on tree-ssa-loop-ivopts.c:constant_multiple_of


Hello,

> Isn't it the case that *any* conversion can be stripped for the purpose
> of this routine?  I get an ICE compiling the Ada RTS a-strfix.adb because
> of that.  The following seems to fix it, but is it right?

no, it is not.  The uses of constant_multiple_of expect that it
determines whether TOP = CST * BOT, except for no-op casts.  It is true
that there are some sequences of casts that in the end satisfy this, but
are not handled by constant_multiple_of, but you would need to be more
careful when changing it.

The bug you describe most probably is PR 21963 (and there is a patch for
this PR submitted).

Zdenek

> *** tree-ssa-loop-ivopts.c	26 Jun 2005 21:21:32 -0000	2.82
> --- tree-ssa-loop-ivopts.c	29 Jun 2005 21:38:29 -0000
> *************** constant_multiple_of (tree type, tree to
> *** 2594,2599 ****
>     bool negate;
>   
> !   STRIP_NOPS (top);
> !   STRIP_NOPS (bot);
>   
>     if (operand_equal_p (top, bot, 0))
> --- 2594,2603 ----
>     bool negate;
>   
> !   /* For determining the condition above, we can ignore all conversions, not
> !      just those that don't change the mode, so can't use STRIP_NOPS here. */
> !   while (TREE_CODE (top) == NOP_EXPR || TREE_CODE (top) == CONVERT_EXPR)
> !     top = TREE_OPERAND (top, 0);
> !   while (TREE_CODE (bot) == NOP_EXPR || TREE_CODE (bot) == CONVERT_EXPR)
> !     bot = TREE_OPERAND (bot, 0);
>   
>     if (operand_equal_p (top, bot, 0))


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